0
我在這裏有這個模板複選框。無論何時點擊,我都需要在我的jQuery中調用。我會如何做,我是新來的模板。jquery-template複選框oncheck
script id="listTemplate" type="text/x-jquery-template">
<div class="task_block clearfix modalRow">
<input type="checkbox" class="itemLinked" name="link" data-itemid="${ItemId}" data-itemtype="${ItemType}" data-linkid="${Id}" {{if IsLinked}}checked="checked"{{/if}}>
<div class="left mls">
這是我在我的jQuery中。
$(document).ready(function() {
$("input[name=link]").change(function() {
alert("test");
});
});
從DOC:_「值:。一個屬性值可以是一個不帶引號的單詞或引用字符串」 _ –
嘗試使用'on()'代替:'$(document).on('change','input [name =「link」]',function(){...});' –
我試過了一個第一,但是像這樣$(「input [name = link]」。on(「change」,function(){並且這兩種方式似乎都不能正常工作.. –