Limit the Characters in textarea in jquery -


i want limit characters in textare in jquery .here jquery code

$('#editnote-tooltip-wrapper').appendto($(this).closest('.editnote-tip-wrapper')).fadein(300).css({ 'position': 'absolute', 'left': 0, 'top': 0, 'z-index': '10000' }).find('.content').html('<textarea cols="5" rows="5" class="elastic" style="overflow: hidden; height: 150px;"></textarea>' + $html); 

how can make possible.anyone help?

to limit character can use maxlength attribute of html. <textarea cols="5" rows="5" class="elastic" style="overflow: hidden; height: 150px;" maxlength="500"></textarea>

anyhow not going work in ie9 can follow below code.

<form name="myform"> <textarea name="limitedtextarea" onkeydown="limittext(this.form.limitedtextarea,this.form.countdown,100);" onkeyup="limittext(this.form.limitedtextarea,this.form.countdown,100);"> </textarea><br> <font size="1">(maximum characters: 100)<br> have <input readonly type="text" name="countdown" size="3" value="100"> characters left.</font> </form> 

refer this page!!. more info.


Comments