when I press Enter I want to insert "< br >"
instead of the new line '\n\r'
in my text area,
Exemple:
i want the text in the text area to be:
"hello <br> dear",
instead of
"hello
dear"
I tried this code but with no luck:
$('#inputText').bind('keyup', function(e) {
var data = $('#inputText').val();
$('#inputText').text(data.replace(/\n/g, "<br />"));
}
` to be visible as you're typing. Wouldn't it be better to convert the data after the fact? If it's stored into a database, you could convert the data just before the insert/update. – Joseph Marikle Jul 06 '17 at 18:18