我正在尝试捕捉 kendo 复选框事件,但我无法让它工作。我确定我错过了一些东西。因为我在这个简单的事情上花了一个多小时,我很累。以下是代码片段。
HTML
<div class="bottomPadding row">
<div class="col-md-4 col-sm-4 col-xs-12 col">
<label>Send Activation Link</label>
</div>
<div class="col-md-6 col-sm-6 col-xs-12 col">
<input id="sendLink" type="checkbox" data-bind="checked: Account.IsLink" />
</div>
</div>
还有JS代码,
$("#sendLink").click(function () {
if (this.checked) {
console.log("hit");
}
});
请纠正我在哪里搞砸了。
P.S:我引用了一些 SO 答案,有些没有答案,有些答案在我的情况下不起作用。
最佳答案
我已经在我的机器上运行了你的代码并且收到了点击事件,这是我的代码:
<div class="row">
<div class="col-md-4 col-sm-4 col-xs-12 col">
<label>Send Activation Link</label>
</div>
<div class="col-md-6 col-sm-6 col-xs-12 col">
<input id="sendLink" type="checkbox" data-bind="checked: Account.IsLink" />
</div>
</div>
<script>
$(document).ready(function () {
clickHookup();
})
</script>
在我的 JS 文件中:
function clickHookup() {
$("#sendLink").click(function () {
if (this.checked) {
console.log("hit");
}
});
}
关于javascript - Kendo Checkbox 检查事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49939973/