问题描述
我正在生成一个动态html表.表中的一列具有可单击的图像(a href
).为了进行测试,我还在同一个div中创建了一个静态表,其结构与动态表类似.
I am generating a dynamic html table. One of the columns in the table has a clickable image (a href
). For testing, I have also created a static table, with similar structure as the dynamic table, in the same div.
我已经定义了一个selectors/a/click.js
事件处理程序,该事件处理程序对于静态表中的链接工作正常,但对于动态表中的链接工作正常.
I have defined a selectors/a/click.js
event handler, which works fine for the links in the static table, but not in the dynamic table.
似乎,由于该表是动态生成的,因此最终不会在该表上附加任何事件处理程序.
It seems that, since the table is dynamically generated, evently is not attaching any event handlers to it.
有人可以为此建议解决方法吗?
Could somebody suggest a workaround for this?
推荐答案
我找到了一种解决方法:在最终的库中使用live
代替bind
:
I found a workaround: use live
instead of bind
in the evently library:
cd vendor/couchapp/_attachments
cat jquery.evently.js | sed -e 's!\.bind(!.live(!'
我将尽力将其推向上游.
I'll try to push this upstream into evently.
这篇关于事件监听器中的动态内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!