.delegate equivalent of an existing .live method in jQuery 1.4.2
- by kim3er
I have an event handler bound to the hover event using the .live method, which is below:
$(".nav li").hover(function () {
$(this).addClass("hover");
}, function () {
$(this).removeClass("hover");
});
It is important to note, that I require both functions within the handler to ensure synchronisation. Is it possible to rewrite the function using .delegate, as the following does not work?
$(".nav").delegate("li", "hover", function () {
$(this).addClass("hover");
}, function () {
$(this).removeClass("hover");
});
Rich