I have a div which is having "contenteditable=true". When i enter text in it, and press enter the cursor goes to the next line by appending <br> in the previous line.
While I use the submit button, I use .text() to get the contents of the div. This strips of any html tags in the div, thus removing all the <br> tags. So no line breaks.
I wanna know, how do i preserve line breaks when submitting the form. Thanks for help...
Don't use Jquery for this, the .text() function removes white space. Use plain Javascript for this:
$(selector)[0].innerText = 'foo';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With