troubleshooting Question

String Manipulation - Issue in showing long unterminated user entry into 2 lines on IE7.

Avatar of mahaq
mahaqFlag for United States of America asked on
Scripting Languages
6 Comments2 Solutions266 ViewsLast Modified:

I am grabbing a val from the jsp input hidden tag.
and taking its value thru the Id.

I have to break the line at 30 characters when the value is returned.

Doing all this in JQuery  DOM ready...

var chkIfStd = $('#chkIfStd').val(); // check for standard
      if(!chkIfStd ){
            $('#TextLink').html(wrapText($('#TextLink').text()));
             
      }


There is a method which wraps the text (written by somebody)


function wrapText(strng) {
      var strLength = strng.length;
      var maximum = 30;
      var myString;
      if (strLength > maximum) {
            myString = myString.substring(0,maximum)+'<br />'+myString.substring(max);
      }
      return myString;
}


Tried using word break in css too but nothing helped, looks like I am not using it right...the function works fine at other places, or may be I need a Regex. (starting with character and not a number or any special character in the string).


ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 2 Answers and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros