Javascript Jquery使用此
我已经搜索过了,但是找不到怎么做。我正在尝试使用Javascript Jquery使用此,javascript,jquery,jquery-selectors,Javascript,Jquery,Jquery Selectors,我已经搜索过了,但是找不到怎么做。我正在尝试使用comment modbox在中隐藏并显示以下元素: $('.comment-wrapper').each(function (index) { $(this, '.comment-modbox').mouseover(function () { $('.comment-modbox').show(); }); $(this, '.comment-modbox').mouseout(function ()
comment modbox
在中隐藏并显示以下元素:
$('.comment-wrapper').each(function (index) {
$(this, '.comment-modbox').mouseover(function () {
$('.comment-modbox').show();
});
$(this, '.comment-modbox').mouseout(function () {
$('.comment-modbox').hide();
});
});
此代码仅隐藏并显示所有注释modbox
,而不管它们是否包含在此
中
谢谢你的帮助
答复:
试试这个()
第二选择:
$('.comment-wrapper').each(function (index) {
var wrapper = this;
$('.comment-modbox', wrapper)
.mouseover(function () {
$(this).show();
})
.mouseout(function () {
$(this).hide();
});
});
谢谢,但这似乎没有任何作用:-(您可以放置一些html来查看“注释包装器”和“注释modbox”的结构,或者只使用$(这个)。查找(..)
,这就是$(..,这个)
在内部所做的。
$('.comment-wrapper').each(function (index) {
$('.comment-modbox', this).mouseover(function () {
$(this).show();
});
$('.comment-modbox', this).mouseout(function () {
$(this).hide();
});
});
$('.comment-wrapper').each(function (index) {
var wrapper = this;
$('.comment-modbox', wrapper)
.mouseover(function () {
$(this).show();
})
.mouseout(function () {
$(this).hide();
});
});