javascript - Hover highlight child should not highlight parent -


i trying highlight element when hover on (adding class). have nested elements on page. want is, if hover on element, immediate element gets highlighted not parent ones.

here snippet

        $("body *").hover(function (e)         {             $(this).addclass('test');         }, function ()         {             $(this).removeclass('test');         });` 

http://jsfiddle.net/3zgqr/1/

try

$(document).ready(function (){     $("body").mouseover(function (e){         $(e.target).addclass('test');     }).mouseout(function (e) {         $(e.target).removeclass('test');     }); }); 

demo: fiddle


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -