Consider the following HTML:
<div id="div">
<button class="foo">Botão1</button>
</div>
And the following script:
$(".foo").click ->
alert "foobar"
$("#div").append '<button class="foo">Botão2</button>'
Run JSFiddle and check out: link
On Button1 the event is triggered. On Button2 no, it was added later.
I would like to know how best to make the event available for the second button, if possible, without having to add the click event again.