Search code examples
jquerymouseoverhtmlmouseout

jquery mouseover question


I have a jquery-script that triggers on mouseover on a div like this:

<div class="myDiv">
    <span class="mySpan">text text text</span>
</div>

The problem is that it acts like mouseout when i hover over the text and I dont want that. I could put an invisible div over it all and trigger the moseover on that but I would like to keep it as simple as possible.

Any suggestions...?


Solution

  • You are looking for mouseleave / mouseenter not mouseout/mouseover

    mouseleave fires when leaving the parent, while mouseout fires on children