Friday, October 30, 2009

[jQuery] Dynamic img not getting events

Hi all,

I have a very simple html structure and the idea is to create and use
DIVs or elements I do dynamically, so there is one div which I use to
do something like:

$("#main").html("<div id='img-lisg'><img id='img1' .....></div>");

That works just fine, the problem is when I try to use events on the
elements I've created dynamically, those just don't work. There is
something like this:
("#dynamicDiv").click(function(){
alert('Testing');
});

It never works,... how should I create the handlers for the DIVs I
create dynamically ?

Thanks

No comments: