Or the title can be put shortly as: Why doesn’t my jQuery events work after an AJAX callback?
Lets create a very simple example jQuery script which simply changes a list’s class on hover:
We’ll assign red as the hover color:
<style type="text/css">
.hover
{
color: #f00;
}
</style>
Then add the jQuery hover() event to toggle/change the list’s class when the mouse hovers over the list. This is how the javascript code will look like inside the document.ready() function:
$("li").hover(
function()
{
$(this).toggleClass("hover");
},
function()
{
$(this).toggleClass("hover");
});








26 Comments 

