Hello everyone, what I'm trying to do is converting a TextArea content into a valid html code. Suppose you type inside the TextArea and then you press a button that shows the typed text inside a element. If you typed something like inside the TextArea:
Hi folks!
Do you like jQuery?
I do!
The resulting string you have to put inside the '' element is:
Hi folks!<br>Do you like jQuery?<br>I do!
That's because the newline inside the TextArea must be converted to the <br>
tag!
The same thing should happend if you want to take the html of the element and put it inside the TextArea input field, for example:
Hi folks!<br>Do you like jQuery?<br>I do!
should be converted to:
Hi folks!
Do you like jQuery?
I do!
So, is there a way to convert a string to html-string (and vice versa) or should I write a function by myself?
Thanks in advance!