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.
jQuery 是否允许我们将 .each 循环用于实时元素?
我正在动态创建单选按钮,需要遍历所有单选按钮,但 .each 循环似乎不适用于实时元素。
如果 jquery 不支持这种实时循环,还有其他方法可以实现吗?
live()仅适用于事件绑定。我唯一想到的是将所有代码放入一个函数中,然后在插入元素后再次执行它。
live()
在循环结束时,初始化单选按钮。
它对我有用。