Jump to content

want to get rid of new line extra space


itpvision

Recommended Posts

Hello,

I have a wysiwig textarea editor, something like this one, I want to update my text, the content is retrieved from database and inserted into this textarea through a javascript function, the first arguemnt passed, which is the data from database, contents additional new lines, so this causes a javascript error,

 

I have tried these:

 

$des  = mysql_result($select2 , 0 , 'des');

 

$des = stripslashes($des);

$des = html_entity_decode($des);

$des = str_replace("\n", " ", $des) ;

$des = preg_replace("/\r?\n/", "", $des);

 

I still see new lines after divs, uls, ols, li(s) lists

Help appreciated

[email protected]

Link to comment
https://forums.phpfreaks.com/topic/107426-want-to-get-rid-of-new-line-extra-space/
Share on other sites

Hello,

I have a wysiwig textarea editor, something like this one, I want to update my text, the content is retrieved from database and inserted into this textarea through a javascript function, the first arguemnt passed, which is the data from database, contents additional new lines, so this causes a javascript error,

 

I have tried these:

 

$des  = mysql_result($select2 , 0 , 'des');

 

$des = stripslashes($des);

$des = html_entity_decode($des);

$des = str_replace("\n", " ", $des) ;

$des = preg_replace("/\r?\n/", "", $des);

 

I still see new lines after divs, uls, ols, li(s) lists

Help appreciated

[email protected]

$des = trim($des) ;

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.