What I'm trying to do is convert a textaria content into a valid HTML code. Let's say that you type inside textaria and then you press a button that shows the text typed inside an element. If you type something like inside textieria:
Hi friends!
Do you like jQuery? I do it
The resulting string should be placed inside the element:
Hi friends! & Lt; Br> Do you like jQuery? & Lt; Br> I do!
This is because the new line inside textieria is & lt; Br>
should be changed into the tag!
The same thing should be done, if you for example:
Hi friends! & Lt; Br> Want to take html of elements and insert it inside the textieria input field? & Lt; Br> what I have to do? & Lt; Br> I do it
should be converted to:
Hi friends!
Do you like jQuery?
I have to!
So, is there any conversion to the html-string (and vice versa) or should I write the function by myself?
Thanks in advance!
With the appropriate style on the element, you should not need to convert anything. Using the CSS white space property with the value set on pre , any white space in the element should look exactly as it is in the form of text:
# myElement {white-space: pre; }
Example:
Comments
Post a Comment