动态追加的内容通过$("selecter").on("click",function(){});添加的事件无法触发,必须通过$("selecter").on("click","selecter",function(){});来添加。
代码示例:
不触发事件的代码
$("#commonProperties :checkbox").on("click",function() {
console.log("commonProperties.click");
changeCommonProperty($(this));
});
触发事件的代码
$("#commonProperties").on("click", ":checkbox",function() {
console.log("commonProperties.click");
changeCommonProperty($(this));
});