hi I have an textarea which anyone can enter text, where they can put line breaks inside the text area.
How can I remove the line breaks created by pressing the enter key? can either be in c# or javascript.
hi I have an textarea which anyone can enter text, where they can put line breaks inside the text area.
How can I remove the line breaks created by pressing the enter key? can either be in c# or javascript.
Try,
text.replace(/\s*/g," ")
This will collapse all contigious whitespace into a single space.
an alternative is to simply ban the use of the enter key in the textarea in the first place, which can be done with event handlers (onKeyPress, for example)
Thanks to Scozzard here's the answer.. http://stackoverflow.com/questions/238002/replace-line-breaks-in-a-string-c