SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Zealot
    Join Date
    Mar 2005
    Posts
    141
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    strange alert box

    I am trying to trace an error using "alert" and have noticed that the alert box is an unusually large size even though it may only be alerting one or two words and those words seem forced to the bottom of the box...like there is hidden white space. Has any one else had this?

  2. #2
    SitePoint Zealot krt's Avatar
    Join Date
    Sep 2005
    Location
    Australia
    Posts
    114
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    For all I know, you could be accidentally alerting a string containing line endings. Any code to show?

  3. #3
    SitePoint Zealot
    Join Date
    Mar 2005
    Posts
    141
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It is part of an ajax thing so the alert is generated by some php.

  4. #4
    SitePoint Evangelist bals28mjk's Avatar
    Join Date
    Aug 2007
    Posts
    405
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ha, sounds like more than one white space. Is the box more wide, more tall, or both? At any rate, trim the string with a regular expression.

  5. #5
    SitePoint Zealot
    Join Date
    Mar 2005
    Posts
    141
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for that. Trimming the returned string with
    Code:
     var text = text.replace(/^\s+|\s+$/g, '');
    worked but I traced the "bloat" to some validation on the server side and would like to trim it before it is returned via Ajax. A similar bit of code in php would work I suppose??


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •