The .val()
property of an item in jQuery for a doesn\'t seem to work with new lines. I need this function as the text-area is mean
The forced new lines in textareas are \n
s, other HTML tags than textarea will ignore these. You have to use
to force new lines at those elements.
I suggest you use JavaScript to fix that rather than CSS as you already rely on JavaScript.
$( "#watched_textarea" ).keyup( function() {
$( "#output_div" ).html( $( this ).val().replace(/\n/g, '
') );
});
You can find the updated version here: http://jsfiddle.net/GbjTy/2/