A way to do this w/o adding another plugin is as follows. I'm sure there are
situations where livequery outperforms this perhaps but I haven't needed it
yet...

Say I'm loading script.html and I want my function, called bobFun, to be
applied to the newly loaded content...

//here's your function
var bobFun = function(){
 //some function
};

//here's how you set it up originally
$("#mydiv").click(bobFun);

//here's how you make apply the same function to your loaded content
$(this).load("script.html", function() {
  $("#mydiv").click(bobFun);
});

Works pretty well for me. Karl's reply with tutorial links follows...

---------- Forwarded message ----------
From: Karl Swedberg <[EMAIL PROTECTED]>
Date: Nov 24, 2007 9:39 AM
Subject: [jQuery] Re: jQuery functions on loaded html

The livequery plugin is excellent. Highly recommended.

If you'd like to learn how to do this sort of thing yourself, check out the
FAQ topic:
http://docs.jquery.com/Frequently_Asked_Questions#Why_do_my_events_stop_working_after_an_Ajax_request.3F


That topic points to this tutorial (which is excerpted from the Learning
jQuery book):
http://docs.jquery.com/Tutorials:AJAX_and_Events


--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com

Reply via email to