JavaScript代碼:
代碼如下:
function counter(object){
var limit = $(object).attr('maxlength');
if($(object).next(".counter").val()==undefined){
$(object).after("<span class='counter'></span>/"+limit);
}
$(object).textlimit("span.counter",100);
}
Html代碼:
代碼如下:
<input type="text" onkeypress="counter(this);" id="partnerinfoname" maxlength="100" />