First, I've tried all possible solutions that I've found here or Google, but no one seems to work for me.
To be clear, I need to remove every empty lines from a text area. This is what I've done so far:
<textarea name="text" class="form-control" rows="14" id="text" placeholder="Here goes our query" ></textarea>
$(document).ready(function () {
$('#text').focusout(function () {
var text = $('#text').val();
text.replace(/(\r\n|\n|\r)/gm,"");
alert('done');
});
});
I get successful alert on end, but those empty lines are still there. Is regexp correct ? My knowledge for js is not that big, so I need help :(