Assigning hover to Ajax data
How do you assign .hover() to data received from an Ajax call? I have a post returning and I wanted to change the bgcolor of the containing div.
Posts.aspx
- <div class="postContainerOut">
<div class="postItem">Column 1</div>
<div class="postItem">Column 2</div>
<div class="clear"></div>
</div>
jQuery
- $("#button").click(function()
{
$.get("Posts.aspx", function(data)
{
$("#content").prepend($(data).fadeIn(1000)); // This works
- // This does NOT work
$(data).find("div[class='postContainerOut']").hover(function()
{
$(this).removeClass("postContainerOut").addClass("postContainerOvr");
},
function()
{
$(this).removeClass("postContainerOvr").addClass("postContainerOut");
});
});
});