tattoos

Friday, January 20, 2012

Jquery convert new line / new row to <br> tag

Let's say I typed in a <textarea> :
I
Love
You

Then I save it to myphpadmin database. Then I use mysql to retrieve it from database and display it onto a <div>. Now the output that show in the <div> is :
I Love You

How to make the <div> show exactly like the database field and textarea which has multiple rows?

My question here.I did try to use css white-space:pre; but it is not working on IE7 and IE5. So I tried to find another solution which replace all new line / new row with <br> tag, I found the solution from here. Here is the codes :

No comments:

Post a Comment

 

blogger templates | Blogger