[jQuery] How to re-apply previous events.
Hi All,
I have some xhtml in my page with images that have certain events. A
click and a mouseover.
When a user uploads another image, it replaces the current ones using
AJAX.
My question is, how can I rebind whatever events where previously on
the images back on the new content?
I want to do something like (very basic example):
var clickFunction = $("img").click(function(){
alert('yo');
return false;
});
Replace image with AJAX.
$("img").click(clickFunction);
This doesn't seem to work though. The reason why I can't just rebind
the previous code is I don't actually know what the events will be as
they change according to other conditions.
I hope I've explained this ok.
Thanks
Tom