Javascript Jquery代码不工作!
我有以下脚本---- 我想要的是,表行中有一个元素,它是用classmember\u profile\u comment\u show\u delete\u按钮指定的!但是有很多这样的表格行!我无法找到一种方法,只在鼠标指向的表格行中显示img 请帮帮我Javascript Jquery代码不工作!,javascript,jquery,jquery-ui,javascript-events,Javascript,Jquery,Jquery Ui,Javascript Events,我有以下脚本---- 我想要的是,表行中有一个元素,它是用classmember\u profile\u comment\u show\u delete\u按钮指定的!但是有很多这样的表格行!我无法找到一种方法,只在鼠标指向的表格行中显示img 请帮帮我 提前谢谢 代码中不需要这个.element,只需要选择器;this之后表示查看此元素内部 $("tr.member_profile_comment_row_frame").mouseover(function () { $("img
提前谢谢 代码中不需要这个.element,只需要选择器;
this
之后表示查看此元素内部
$("tr.member_profile_comment_row_frame").mouseover(function () {
$("img.member_profile_comment_show_delete_button", this).show();
});
$("tr.member_profile_comment_row_frame").mouseout(function () {
$("img.member_profile_comment_show_delete_button", this).hide();
});
你应该在这里用一个。看起来像:
$('table').delegate('tr', 'mouseenter', function(e) {
$(this).find('img.member_profile_comment_show_delete_button').show();
}).delegate('tr', 'mouseleave', function(e) {
$(this).find('img.member_profile_comment_show_delete_button').hide();
});
这样做的好处是,所有
节点(到
节点)只绑定一个事件处理程序
您当前的代码也应该可以工作(除了
这个.元素
需要通过这个
替换),但是它会将事件处理程序显式绑定到每个
。您能在这里显示完整的页面标记吗?
$('table').delegate('tr', 'mouseenter', function(e) {
$(this).find('img.member_profile_comment_show_delete_button').show();
}).delegate('tr', 'mouseleave', function(e) {
$(this).find('img.member_profile_comment_show_delete_button').hide();
});