I have some ajax th开发者_开发问答at pulls information into a table and i am trying to use livequery to add a class to every second row
$('a').livequery('click', function(event) {
$(".scroll-pane table tr:odd").addClass("Odd");
});
The problem is that the class is only added for a short period of time and then it simply vanishes? I am using jquery 1.4.1 and Livequery 1.0.3
You no longer need to use the livequery plugin with jquery 1.4.x. Use the live
method instead.
Alternatively, you can rebind the click/set the class after each ajax call in the success callback.
If you are stuck with legacy livequery code you cant change, then you need to use livequery 1.1 or later but I dont recommend this.
Version 1.1.1 of Livequery adds compatibility fix with jQuery 1.4.1, so maybe the easiest solution is to try using the newest version of Livequery. If the problem still exists, tell me.
精彩评论