Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
jquery父子单击事件处理_Jquery_Click_Parent_Stoppropagation - Fatal编程技术网

jquery父子单击事件处理

jquery父子单击事件处理,jquery,click,parent,stoppropagation,Jquery,Click,Parent,Stoppropagation,我有一个表行,其中有两列是我动态添加的(如下所示) 有什么建议吗?您的选择错误。改用a.msg\u head: $("a.msg_head").click(function(e) { alert('jquery msg_head click'); }); 或者干脆去掉标记选择器,使用$(“.msg\u head”)更新的帖子来显示代码。谢谢“它只调用父处理程序”是什么意思?是否在分配事件处理程序后添加行?然后,您需要使用上的委派事件。 $(".msg_head a").click(fu

我有一个表行,其中有两列是我动态添加的(如下所示)


有什么建议吗?

您的选择错误。改用
a.msg\u head

$("a.msg_head").click(function(e) {
    alert('jquery msg_head click');
});

或者干脆去掉标记选择器,使用
$(“.msg\u head”)

更新的帖子来显示代码。谢谢“它只调用父处理程序”是什么意思?是否在分配事件处理程序后添加行?然后,您需要使用上的
委派事件。
$(".msg_head a").click(function(e) {
    e.stopPropagation();
    alert('jquery msg_head click');
});
$("a.msg_head").click(function(e) {
    alert('jquery msg_head click');
});