首页 > 解决方案 > 未捕获的类型错误:this.is 不是函数

问题描述

我在this.is. 有其他选择吗?

 function UpdateTotalPrice() {
    $('input[type=checkbox]').each(function () {
        var id = this.id;
        if (id.indexOf("chkSelected") > -1) {
            if (this.checked && this.is(':disabled')==false) {
              //  alert(id);
                getPrice(this);
            }

        }
    });

}

标签: javascriptjquery

解决方案


您应该将其用作 jQuery 对象。例如$(this)。您的代码应如下所示:

 function UpdateTotalPrice() {
    $('input[type=checkbox]').each(function () {
        var id = $(this).id;
        if (id.indexOf("chkSelected") > -1) {
            if ($(this).checked && $(this).is(':disabled')==false) {
              //  alert(id);
                getPrice(this);
            }

        }
    });

}

推荐阅读