【问题标题】:Icefaces 1.8.2 and JQuery 1.5.2Icefaces 1.8.2 和 JQuery 1.5.2
【发布时间】:2012-01-15 10:32:24
【问题描述】:

想要显示 textarea 的字符数。我正在尝试通过 jquery 来实现这一点。

当用户输入时我收到此错误

Cannot read property 'length' of undefined (anonymous function) onkeyup

我的 jquery sn-p

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,以及如何绑定此方法..

标签: jquery jsf icefaces


【解决方案1】:

试试这个伙伴:

http://jsfiddle.net/VGpgP/3/

你有可能以这种方式实现你的吗?

【讨论】:

  • 给我一个错误Uncaught TypeError: Cannot read property 'value' of undefined (anonymous function) onkeyup
猜你喜欢
  • 2012-05-25
  • 2010-12-15
  • 1970-01-01
  • 2013-02-12
  • 1970-01-01
  • 2011-07-10
  • 1970-01-01
  • 1970-01-01
  • 2012-09-24
相关资源
最近更新 更多