I’m not sure why I’m not figuring this out… I do this all the time. Must be having a “Monday Moment.” But, basically, here’s what I have:
$('#nav ul li a').hover(hoverOn, hoverOff);
function hoverOn (evt) {
//how do I get the index of which button was hovered (from the jQuery group)?
}
My code looks like this:
<div id="nav">
<ul>
<li><a href="#" id="index">Home</a></li>
<li><a href="#" id="about">About Us</a></li>
<li><a href="#" id="services">Services</a></li>
<li><a href="#" id="resources">Resources</a></li>
<li><a href="#" id="contact">Contact</a></li>
</ul>
</div>
If your element is an
<a>then you need to get the parent<li>index: