JQuery .live() and Document ready?

You could use the Livequery plugin It binds itself to DOM mutation events to track changes in the DOM, and re binds and re executes code attached to them, e. G: $(". Data tr:odd").

Livequery(function(){ $(this). AddClass("evenrows"); }).

You could use the Livequery plugin. It binds itself to DOM mutation events to track changes in the DOM, and re binds and re executes code attached to them, e. G: $(".

Data tr:odd"). Livequery(function(){ $(this). AddClass("evenrows"); }).

Pǝlɝɥʞ, that's a great solution so +1. I still feel like there must be a way to use .live() to do this. The idea is to put the .

AddClass in $("body"). Live("load", function(){}); which doesn't work obviously. Is there a solution like this or am I resigned to use a plug-in?

– jeerose Nov 4 '09 at 21:27 @jeerose I'm afraid you would have to use a plugin for this case... Because the jQuery.live() is for binding events only, and what you are trying to do here is clearly not an event – pǝlɝɥʞ Nov 5 '09 at 10:23 You could find out which event Livequery is binding to on the document, and do your own event delegation on that same event. – Mark Nov 6 '09 at 18:59 @Mark I'm afraid it's a bit more complicated than that.... DOM Mutation events are not fired (at least not reliably AFAIK) in IE. Livequery takes out the hassle of cross browser DOM mutation events – pǝlɝɥʞ Nov 7 '09 at 1:43.

We've accomplished this by hooking into the Ajax event delegates and doing whatever we want there. See "Complete" here: docs.jquery.com/Ajax/jQuery.ajax#options You would use Live to attach any event handlers to those new rows. See: docs.jquery.com/Events/live#typefn.

I was using complete. I just thought there would be a more efficient solution given that right now I have the function that fires when the DOM is ready, then I have to attach it to any ajax calls I have. I'd rather not have to worry about remembering to do that.

Also that means I'm writing it over and over for each ajax call. Thoughts? – jeerose Nov 4 '09 at 16:43 You don't have to write it over, just call the same method in both places.

– Mark Nov 5 '09 at 21:37.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions