Display textarea content with line breaks in html page

January 31, 2008 at 12:21 pm 2 comments

Let us see how javascript, php, and ruby display the content of textarea with line breaks

Javascript:

document.getElemnetById(‘textareacontent’).value.replace(/\n/g,'<br>’);

PHP:

preg_replace(“/\n/”,”<br>”,$_REQUEST[‘t1’]);

Ruby:

(teaxtareacontent).gsub(/\n/,”<br>”)

Advertisements

Entry filed under: Technical. Tags: , , , .

PHP Singleton Object House for Rent

2 Comments Add your own

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Trackback this post  |  Subscribe to the comments via RSS Feed


Pages

Blog Stats

  • 33,765 hits
January 2008
M T W T F S S
« Dec   Feb »
 123456
78910111213
14151617181920
21222324252627
28293031  

Twitter Updates

Error: Twitter did not respond. Please wait a few minutes and refresh this page.

religion and spirituality

%d bloggers like this: