jquery - What happens if you call $(document).ready after the dom has loaded? -
i'm debugging code (that did not write) , javascript pulled page after initial dom.ready call via ajax request contains:
$(document).on('ready', function(){ $('#input1').attr('data-defaultvalue',123); }); am right in thinking code inside function never fire waiting event has happened.
there
$(document).on( "ready", handler ), deprecated of jquery 1.8. behaves ready method if ready event has fired , try.on( "ready" )bound handler not executed. ready handlers bound way executed after bound other 3 methods above.
you can test code pretty easily. .ready fire, .on('ready'... not.
settimeout(function() { $(document).ready(function() { alert(".ready"); }); $(document).on('ready', function() { alert(".on('ready')"); }); }, 5000);
Comments
Post a Comment