I allow users to put content on my website using HTML TextArea
, but whenever they upload content, it doesn't contain linebreaks, even if they were to hit enter twice. How can I put linebreaks in?
views:
128answers:
2
A:
If you are displaying the contents of the textarea in html you could replace linebreak characters with <br/>
.
Guster_Q
2009-08-22 16:29:13
i did that dont know why but it ignores the <br/> or any html tag what can i do??
eli
2009-08-22 17:15:05
+1
A:
What text editor are you using?
If you aren't using one, then you'll need to have JavaScript insert <p></p>
or <br /><br />
after every time they hit 'enter'.
Of course, if users are putting content on your site, then you also need to watch any HTML they can put up, and make it so that they can't upload 'bad' HTML.
Jeff Atwood wrote one such utility for C#. You'll have to check and see if whatever language you're using on the back end supports it.
George Stocker
2009-08-22 16:31:23
hii and thanks for your helpi not using any editor .and when users put there content it also puts <br/> after every line breakbut when they want to see the content but not in the editor so it shows with no line breaksi dont know why it happens .i dont know why but it ignores the <br/> or any html tagwhat can i do??
eli
2009-08-22 17:12:55
What site are you referring to? Can you post the code that does the POST of the TextArea code?
George Stocker
2009-08-22 17:21:40