How can I do this with the JS replace() method:
Make \n\n change to <p>$1</p>
Change single \n to <br>
Then back again. I think I have this part, see the JS at the bottom.
Example HTML:
<p>Hello</p><p>Wor<br>ld</p>
The <textarea> would look like:
Hello
Wor
ld
So, how can I achieve this? It's an AJAX form where when you click on this div it changes to a <textarea> and back, and fourth, etc. So, I need to it to go from <p>s and <br>s to \n\n and \n. For the going to <textarea> from HTML I have:
$(this).html().replace(/\s?<\/?(p|br\s?\/?)>\s?/g,"\n")