看起来jQuery并没有克隆事件,而只是复制了html/xml

It doesnt seem that jQuery clones events, but just the html/xml?

本文关键字:复制 html xml 并没有 jQuery 事件 看起来      更新时间:2023-09-26

我有一个测试脚本,我写作为一个演示,我正在构建一个模板,但当我克隆它,它似乎不触发事件。

var $shifter = $("<a class='shifter'>^</a>");
$shifter.click(function(){
    alert("ping");
});

你可以查看我的整个模板:http://jsfiddle.net/fallenreaper/drdCp/2/一切都是在Javascript中完成的,所以HTML中只包含样例表单PRE-COMPONENTS。

使用.clone(true)克隆事件

相关文章: