<script>
$('#textarea_').on('keyup', function () {
var textareaContentWithJquery = $('#textarea_').val();
var textareaContentWithJavascript = document.getElementById('textarea_').value;
});
</script>
<textarea cols="20" id="textarea_" name="textarea_" rows="2">
Some text in textarea here is created without pressing enter,
just plain text. But how can i get the position
of newline markup from textarea so that i can put <br> there?
</textarea>
i get value from textarea like that(plain text);
Some text in textarea here is created without pressing enter, just plain text. But how can i get the position of newline markup from textarea so that i can put <br>
there?
If I were to press enter in textarea and pass to new line then it would be easy because there would be an \n
at the place where I press enter but when I just add text and let the textarea wrap the text to a new line then I have no \n
there in the text.
I need it to be like this (not plain text) ;
Some text in textarea here is created without pressing enter,\n
just plain text. But how can i get the position\n
of newline markup from textarea so that i can put <br> there?\n
So i would easily replace \n with <br>
Some text in textarea here is created without pressing enter,<br>
just plain text. But how can i get the position<br>
of newline markup from textarea so that i can put <br> there? <br>
textareaContentWithJquery and textareaContentWithJavascript gives the same result i mean without \n
markup. So they are useless.