I have a textarea element and on top of it, I also have a div block that superimposed exactly over the textarea (eg:-facebook comment box).Everything is going cool and fine not until this line-breaks comes into the scene. So I'm trying to detect every single line breaks( natural word-wrap) in the text area and insert a <br/>
tags into the div block whenever it encounters.
Actually, looping over the characters in the textarea could have solve the issue but this would overkill the process particularly when the value of the textarea happens to be very long.
The "wrap-hard" attribute of the html5 is exactly what I need it but that requires one to submit the form.
Can someone suggest an ideal way to detect natural line breaks in the textarea? Many thanks!!!