I’m doing a web builder and I’m having a bit of trouble.
I want to have a textarea that you can enter text that you want to your TEXT element. This element I disabled the HTML when it´s later off previewed by simply putting a .innerText before posting preview. Though, I might just need the <br> tag.
I can use PHP or JS. Any ideas?
When you are typing in a textarea, and the return key is pressed,
What actually goes on behind the scenes is this
which produces the following in the textarea.
Hence, what you would need to do is essentially change the \n (newline) to break tags.
http://php.net/manual/en/function.nl2br.php