I've got a <textarea>
and a <div>
(with a <p>
inside).
When entering text into the area, the <p>
gets updated with the content upon keyUp.
Is there a way to preserve linebreaks (new line) from the textarea and somehow get them to work like linebreaks in the div/p?
Replacing double "new line" with </p><p>
, is that possible as well? This is close to what a wysiwyg would handle, but don't want that for this, which is a very small project.
This is what I've got so far.
$(".box textarea").keyup(function () {
var value = $(this).val();
$('.box p').text(value);
});