Hello,

I found myself adding elements to a page, and then adding behaviour to
these elements.

What I did was :

$('.container').each(function(){
   $(this).prepend('<a class="dosomething" href="...'">Do something</
a>')
     .find(".dosomething").click(function(){return
doSomething(this);});
...

It works, but I don't find very elegant this add, search the element I
just added and bind the event way.

Is there a way to combine properly the prepend and the bind an event
steps ?

Thanks in advance,

X+

Reply via email to