jQuery hover() event on div element within a button element

Posted by jakeisonline on Stack Overflow See other posts from Stack Overflow or by jakeisonline
Published on 2010-03-24T23:41:27Z Indexed on 2010/03/24 23:43 UTC
Read the original article Hit count: 184

Filed under:
|
|

I can't seem to get jQuery to notice the div within the following markup

<button class="button submit positive right" id="omnisubmit" type="submit">
    <div class="label">Submit</div> 
    <div class="controller">&nbsp;</div>
</button>

And here is the jQuery I'm currently using:

$("button#omnisubmit div.controller").hover(function () {
            console.log("Hover...");
        });

However, jQuery doesn't seem to pick up when the mouse is hovering over that div, $("button#omnisubmit div.controller").hover( works correctly, of course.

I have a feeling it's because putting divs inside buttons may not be standard HTML?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery