想要显示textarea的字符数。我试图通过jQuery实现这一点。Icefaces 1.8.2和JQuery 1.5.2
我收到此错误时
Cannot read property 'length' of undefined (anonymous function) onkeyup
我的jQuery片断用户类型
var $j = jQuery.noConflict();
function limitChars(textid, limit, infodiv){
var text = $j('#'+textid).val();
var textlength = text.length;
if(textlength > limit){
$j('#' + infodiv).html('You cannot write more then '+limit+' characters!');
$j('#'+textid).val(text.substr(0,limit));
return false;
}
请建议需要加以纠正
您需要向我们展示你的HTML,以及如何绑定此方法.. –