HTML的事件属性:JQuery的:与克隆制成的元件()不采取原
<h2>CHECK AS MANY AS YOU CAN</h2>
<form id="boxone">
</form>
JS:
$boxone = $("#boxone");
$boxone.html('<input type="checkbox" class="fourthboxes">');
$fourthboxes = $(".fourthboxes");
for(var i=0; i <341; i++) {
$fourthboxes.clone(true, true).appendTo($boxone);
}
$fourthboxes.change(function() {
alert('yo');
});
复选框的其余不,当我提醒点击它们,只有原来的那个 我甚至尝试过$ fourthboxes.on('点击'...而不是任何东西 我看了一下这个问题并尝试了解决方案,但它没有工作。
jQuery clone() not cloning event bindings, even with on()
谢谢!这工作 – user298519
不客气。 – trincot