查找可点击的元素 [英] Find clickable elements
本文介绍了查找可点击的元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法找到用click()或live('click)指定的所有可点击元素?
Is there a way to find all clickable elements specified with either click() or live('click) ?
如果要单击任何这样的元素,我想执行一些操作.
I want to perform some actions if any of such elements are clicked.
$('.container').bind('click', function(event) {
// actions
});
这捕获所有点击.
谢谢.
推荐答案
这可以做到:
$.each($('.container').find("*").andSelf().data("events"), function(i, event) {
$.each(event, function(j, h) {
if(j = 'click')
{
//Do stuff to $(this)
alert(j);
alert(h.handler); //Gets the actual handler for each event ( inject code >=] )
}
});
});
正在工作的JSFiddle
这篇关于查找可点击的元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文