javascript - 未捕获的类型错误: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);
}
}
});
}
解决方案
您应该将其用作 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);
}
}
});
}
推荐阅读
- javascript - 自动格式化输入字段中输入的 10 位电话号码
- javascript - 如何在我的 react-leaflet 组件中设置状态
- c++ - 使用 C++ 的 UVA Judge Online 的运行时错误(问题 10050)
- c# - C# 温度转换器显示不正确的摄氏温度结果
- autohotkey - AutoHotKey 用百分比替换美元符号
- html - Angular 9 - 具有相同名称的不同formGroupName formControlName会影响相同的formControlName
- flutter - 颤振上的 Box2D 仿真非常缓慢
- html - 带有 CSS 的网站的可滚动背景图像封面
- python - 如何使用 hd5f 访问 *.mat 文件中的嵌套结构?
- c++ - 无法让 zip_utils 处理 gzip 文件