[jQuery] How to add event to $.get() result?
Hello all
I have following:
$(document).ready(function() {
...
$(".bar").click(function(){
$.get("/foo" ,{foo:$(this).attr("test")},
function(data){$("#bar").html(data); // data = <a class="bar"/>
});
});
...
}
and html:
<div id="bar">
<a class="bar"/>
</div>
It works fine at first! But, after the $.get(...). the onclick seems
not registered on <a class="bar"/>
Does anyone know how solve this?