Skip to content Skip to sidebar Skip to footer

Jquery Multiple Selectors With This

I've searched but can't find how to do this. I'm trying to make the elements with comment-modbox inside this hide and show: $('.comment-wrapper').each(function (index) { $(th

Solution 1:

try this (jQuery("selector", context)...)

$('.comment-wrapper').each(function (index) {

    $('.comment-modbox', this).mouseover(function () {
        $(this).show();
    });

    $('.comment-modbox', this).mouseout(function () {
        $(this).hide();
    });
});

Second choice:

$('.comment-wrapper').each(function (index) {

    var wrapper = this; 

    $('.comment-modbox', wrapper)
        .mouseover(function () {
            $(this).show();
        })
        .mouseout(function () {
            $(this).hide();
        });
});

Post a Comment for "Jquery Multiple Selectors With This"