<div class= "Form-group" ><label class= "col-sm-3 control-label no-padding-right" for= "form-field-5" > Content </label><div class= "col-sm-9" ><textarea class= "col-sm-8" id= "form-field-5" placeholder= "Please enter content ..." ></textarea></div></div>
Jquery.extend ({textareaautosize_dc:function () {$ ("textarea"). On ("KeyUp", function (e) {var Currententercount = $ (This ). Val (). Split ("\ n"). Length;var lineheight = number (this). CSS ("Line-height"). Replace ("px", "")), var Entercount = $ ( This). attr ("Entercount"), if (Currententercount < Entercount && Entercount! = undefined) {//line minus fixed line height $ (this). Height ($ (this). Height ()-lineheight);} else if (Currententercount > Entercount) {//each row is added with a fixed line height of $ (this). Height ($ (this). Height () + lineheight); $ (this). attr (" Entercount ", Currententercount);} Records the current line height $ (this). attr ("Entercount", Currententercount);}); /Call Automatic height $.textareaautosize_dc ();
Write a multi-line text box [textarea] Automatic height jquery plugin