I have a javascript code and I couldn't understand that how it is executed after inserted to dom with jquery.
Also is domready event is triggered after a dom append|insert operation? It couldn't be happen but how this code is working if its not?
function insert() {
var data = '<script type="text/javascript"> $(function(){ alert("insert"); });<\/script>';
$("#example").html(data);
}
$(function () {
//If domready is triggered with the .html() method why this is not executed second time?
alert('ready');
});
jQuery( document ).trigger("ready").off("ready");So, once a ready event is fired, it is unboundalert(''ready'')isn't run twiced. Also what I think that$(function(){ alert("insert"); })this code block isn't executed through ready event. It is executed differently, am I right?