Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试选择已克隆的元素
$("THINGS TO CLONE").clone().appendTo("CONTAINER");
它应该看起来
> <CONTAINER> > > <CLONED THING> <CLONED THING> <CLONED THING> > > </CONTAINER
我做到了,但是这些东西对于选择是不可见的。
那没有意义。如果你正确地克隆了你的元素,并以某种方式将它们插入到 DOM 中,那么使用 jQuery 就可以完美地选择它们。
但是,如果您想选择克隆的元素,一种方法是在将原始的内存中克隆对象放入 DOM 之前对其进行缓存。
var clone = $('#foo').clone(); // do stuff with clone clone.doBackflips(); // append it to the DOM clone.appendTo('#container');