SuperfluousApostrophe
SuperfluousApostrophe

Reputation: 25

jquery .hover() error

In the following code, I am attempting to act upon the li element being hovered over.

HTML:

<div id="featured">
         <ul>
              <li class="active">foo</li>
              <li class="">bar</li>
              <li class="">giraffe</li>
         </ul>
    </div>

JavaScript:

  $(document).ready(function () {
        $('#featured ul li').hover(function(){
        //do stuff, or not
        });
    });

But this line of code is causing the following error in FF and I'm clueless as to what is causing it.

g.guid is undefined

This occurs even if the line of JS has nothing occurring inside the function. Any insight would be welcome :)

Upvotes: 0

Views: 459

Answers (2)

Sparkup
Sparkup

Reputation: 3754

Jquery hover has 2 functions:

$(document).ready(function () {
    $('#featured ul li').hover(
       function(){
        //do stuff on hover over
       },
       function(){
        //do stuff on hover out
       });
});

Upvotes: 0

Mrchief
Mrchief

Reputation: 76208

What version of jQuery are you using? That sounds like an old version. Also prior to v1.4, .hover() takes two functions.

Upvotes: 2

Related Questions