Showing posts with label ExtJS. Show all posts
Showing posts with label ExtJS. Show all posts

Wednesday, June 19, 2013

Replace Line Break and Spaces on Text Area using java script !

A simple way to replace line break and spaces on a text area content can be done simply by replacing the line break value and the space value with the corresponding html tag as following .

function replaceLineBreaksAndSpaces(textValue) {
   textValue = replaceSpaceCharacter(replaceLineBreak(textValue));
   return textValue;
}
   
function replaceLineBreak(textValue) {

    textValue = textValue.replace(/\r?\n/g, ' 
<br />');
    return textValue;

}

function replaceSpaceCharacter(textValue) {

    textValue = textValue.replace(/  /g, ' &nbsp;');
    return textValue;
}

Read More...

Pages

 ©mytechtoday.com 2006-2010

 ©Mytechtoday

TOP