the jquery index() seems not recognize one of the element, always say “cannot read property ‘length’ of undefined” here is my code.. mnumber is the one causing problems.i need number and mnumber to be able to track use mouse, and give them correct value base on which box they hover to.
$(".module-details-lesson-container").hover(function () {
var number = $(".module-details-lesson-container").index(this) - 9;
var mnumber = $(".module-container").index(this);
jQuery.each(modules[1][number], function (index, value) {
$(".module-details-words-learned-body").eq(1).append("<div class='module-details-word'>" + value + '</div>');
});
}, function () {
$(".module-details-word").remove();
});
css file
<div class="module-container">
<div class="module-tab envelope-heading white-font"></div>
<div class="module-body">
<div class="module-details-lesson-container"></div>
<div class="module-details-lesson-container"></div>
</div>
<div class="module-details-words-learned">
<div class="module-details-words-learned-body ">
<div class="module-details-word"></div>
</div>
</div>
</div>
I think it have to be
$(this)instead ofthiseverywhere it mentioned