javascript - How to detect new row in textarea while typing without setting Line height using JQuery? -
is there way detect in jquery; whether new row got created in text area while end user typing continuously in it? not set line height, max height of minheight of textarea.
fiddle: http://jsfiddle.net/5wdzh/113/
note: here not asking \n (enter) new row
enteredtext = $( ).val(); numberoflinebreaks = (enteredtext.match(/\n/g)||[]).length; //when press enter value comes not new row.
textarea attributes:
$(e).css({'height': 'auto', 'overflow-y': 'hidden'}).height(e.scrollheight);
there 2 ways 1) if want identify enter press can increase row counter if(e.keycode == 13) { //increment row counter }
2) if using fixed width of textarea can count number of words can fit in 1 row. no of character divide factor give number of rows
i think you
Comments
Post a Comment