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>

  1. window onload: :is fired when content including images has been loaded

  2. document.ready : fired after html document loaded

so guess cannot combine 3 events ready,load , click way have tried

hope helps


Comments

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -