[jQuery] How to bind to a dynamically created object

[jQuery] How to bind to a dynamically created object


Isn't it possible to bind to a previous created object? I've the
following code
for (var i in data) {
$('#eintragsliste').append(
'<tr><td><table><tbody>' +
' <tr>' +
' <td><img class="expanding" src="images/plus01.png"></
th>' +
' <td>...</td>' +
' </tr><tr class="expanded">' +
' <td>&nbsp;</td>' +
' <td>...</td>' +
' </tr>' +
'</tbody></table></td></tr>');
}
$('.expanding').bind('click', collapser_collapse_all);
}
function collapser_collapse_all () {
$
('.expanded').hide().removeClass('expanded').addClass('collapsed');
$('.collapsing').hide();
$('.expanding').show();
}
Yet when I click on the image with class="expanding" the
collapser_collapse_all isn't executed. If I bind to a static object it
works.
$('.expanding_all').bind('click', collapser_expand_all);
<img class="expanding_all" src="images/plus01.png">
What's wrong? See sample at http://www.orpatec.ch/termola/index.php?page=orgslist.php
O. Wyss