robert_gsfame Posted April 23, 2010 Share Posted April 23, 2010 I pass the value from php code into javascript function and i have <textarea> where i put inside innerHTML, but i have this <br /> always attached when new line created although i have decode the value using unescape() how can i erase the <br /> Quote Link to comment Share on other sites More sharing options...
callesson Posted April 23, 2010 Share Posted April 23, 2010 http://www.knowledgesutra.com/index.php/Remove-Ltbr-Gt-Tags-Textarea-Data_t18950.html ? Quote Link to comment Share on other sites More sharing options...
xenophobia Posted April 23, 2010 Share Posted April 23, 2010 You need to filter your output before printing to the textarea. You need this to convert the <br /> tag to a newline: <?php function br2nl($string){ $return=eregi_replace('<br[[:space:]]*/?'. '[[:space:]]*>',chr(13).chr(10),$string); return $return; } ?> Its a reverse function of nl2br. Once you filtered your output, then only you print to your textarea. Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted April 23, 2010 Share Posted April 23, 2010 eregi_replace is deprecated and should no longer be used. Also, doesn't php have a nl2br function? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.