jquery selector parent on hover code example
Example 1: jquery selector parent on hover
$('table').on('hover', 'td', function () {
var selector = $('selector_in_td', $(this));
if (selector.length > 0) {
//Your code
}
});
Example 2: jquery selector parent on hover
//styling child while mouse is inside child element
$('child').on('hover', function(e){
if (e.type == 'mouseenter'){
$(this).css('background','yellow');
}
})
// styling child while mouse is inside parent
$('child').parents().on('hover', function (e){
if (e.type == 'mouseenter'){
$(this).css('background', 'blue');
}
})