javascript - events load and ready not firing -
this code:
$(document).on('ready load click',function(){ console.log('hiihuhu') })
i included jquery script above. problem click event firing load or ready event not. don't see error in console. problem?
which version of jquery using
according jquery docs
$(document).on( "ready", handler ), deprecated of jquery 1.8 , removed in jquery 3.0. note if dom becomes ready before event attached, handler not executed.
$( window ).load(function() { alert("hello"); }); $(document).ready(function(){ $(document).on('click',function(){ alert("in click event"); }); });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div>hello</div>
window onload: :is fired when content including images has been loaded
document.ready : fired after html document loaded
so guess cannot combine 3 events ready,load , click way have tried
hope helps
Comments
Post a Comment