I have a div in which an unordered list is being loaded into, dynamically. First, let me say that when the ul is hardcoded in, it works perfectly, the problem occurs when a new ul is loaded. Here's my javascript:
$('#products ul li').hover(function(){
$(this).find(".productDesc").fadeToggle("slow");
});
The html of the code that is dynamically loaded into <div id='products'></div>
is structured like so:
<ul id='category1'>
<li>
<p class='productDesc'>description 1 here</p>
</li>
<li>
<p class='productDesc'>description 2 here</p>
</li>
</ul>
The problem lies in "this
". When the new UL is dynamically loaded, "this
" no longer seems to refer to the element I'm hovering on. Instead, it seems to refer to nothing at all. What can I do to make "this
" work properly?