I am trying to apply a style when the mouseenter event is triggered, but if I uncomment the following  untouched selector - even the document ready stops working.
<body>
<div id="1" class="button untouched"></div>
<script src="/jquery.js"></script>
<script>
$(document).ready(function(){
    alert("JQuery is working");
});
/*
$(".untouched").mouseenter($function(){
    $(this).addClass("touched");
});
*/
</script>
</body>
I am following the example found at:
http://api.jquery.com/mouseenter/
And I get the following error in Firebug:
missing ) after argument list
[Break On This Error]   
$(".untouched").mouseenter($function(){
Since it does not work, I've made a mistake, but I don't know what. All I know is that none of my code works if I let that run. I downloaded the latest 1.7.2 version of jQuery, which I know is available on the page because the alert() runs with the other commented out.
No need for the $ in front of the function. Also, the mouseenter event function code should be inside the document ready.
<script>
     $(document).ready(function(){
         alert("JQuery is working");
         $(".untouched").mouseenter(function(){
             $(this).addClass("touched");
         });
     });
</script>
                        In your script the $(".untouched") part should be within the ready function. Also, 
mouseenter($function(){ the $ sign is not correct.
Your final script should look like this:
$(document).ready(function(){
    alert("JQuery is working");
    $(".untouched").mouseenter(function(){
        $(this).addClass("touched");
    });
});
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With