hover - Select the littlest hovered element with JQuery -


I think the question is in the title: I want to implement a style to apply style only when the user Clicks. How do I choose this very element?

Thank you.

Style on the div and parents have not been affected, so do you stop the bubble like this Can be:

  $ ("div"). Click (function (e) {$ (this) ToggleClass ("myClass"); e.stopPropagation ();}); For the   

hover case, you would actually like mouseover and mouseout In this case, instead of mousecenter and mouseleave (which binds it), instead of:

  $ ("div") (Function (e) {$ (this) .addClass ("myClass"). Parent (). RemoveClass ("myClass"); e.stopPropagation ();}) Mouseout (function () {$ (this) .removeClass ("MyClass");});  


Comments