[jQuery] reusing events on freshly ajax updated content

[jQuery] reusing events on freshly ajax updated content


Hello,
I am just starting out with jQuery – I used to use prototype. I must
say jQuery really makes reusing functionality very simple. However I
am having a little trouble reusing events on freshly ajax updated
content.
...
<div id="myDivBtn"></div>
<div id="myDiv">
Old Content
<div class="myClass"></div>
</div>
...
in the $(document).ready() event-function I have the following events:
$('#myDivBtn').click(function() { $('#myDiv').load('script.php'); });
$('.myClass').click(function() { /* do something */ });
script.php would produce something like:
...
New Content
<div class="myClass"></div>
...
Both functions work fine. Except when I attempt to use the class
selected event on the new content it doesn't work.
I assume that the newly ajax updated content has not been initialized.
What do I have to call after an ajax updating function to ensure
working events? I googled for some info on this, but didn’t find
anything. Maybe one of you can help. :)
Hope my problem is halfway understandable ;)
Thanks
Casper