31
rated 0 times
[
35]
[
4]
/ answers: 1 / hits: 123484
/ 15 Years ago, sun, january 10, 2010, 12:00:00
What I would like is to count the number of lines in a textarea, e.g:
line 1
line 2
line 3
line 4
should count up to 4 lines. Basically pressing enter once would transfer you to the next line
The following code isn't working:
var text = $(#myTextArea).val();
var lines = text.split(r);
var count = lines.length;
console.log(count);
It always gives '1' no matter how many lines.
More From » jquery