My HTML looks like this
<div id="current"> </div>
<div class="data1">
<div class="foo"><p>Some Text</p></div>
</div>
<span onclick="replace()">Click to replace div</span>
My JQuery/javascript is like this
$(document).ready(function() {
$('.foo').click(function() {
alert('worked');
})
})
function replace() {
$('#current').html($('.data1').html());
}
The alert triggers fine on the .foo class within the .data1 div but after replacing the contents of #current with .data1, the onclick event doesn't trigger on the .foo class within the first div.
What am I missing? Any help would be appreciated!