I am having an issue with the following bit of code. I'm trying to retrieve the index of the li element that is currently being hovered over.
HTML:
JavaScript:
$(document).ready(function () {
$('#featured ul li').hover(function(){
console.log($(this).index()); //returns -1
console.log($('li').index($(this))); //returns integers beginning at 6
});
});
The first option in javascript I used returns a -1 and the second returns integers starting at 6.
I'm lost. Please someone show me what I'm doing wrong! :)
Also, I am using the version of jQuery embedded withing my drupal install, 1.2.6
Edit:Fixed the syntax on the second console.log of my JS example.
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)