The difference between native JS and JQuery

1. The entry function loading mode of native js and jQuery is different

  


  •   Native js and other page DOM will be executed after loading and resources such as pictures are also loaded;
  •   jQuery waits until the page DOM is loaded and executed, and will not wait for resources such as pictures to be loaded;

    (That is to say, it is not advisable to query the properties of resources used after loading the page through jQuery's entry function: for example $(document).ready(function(){ $('img').width();}); )

 


  • Repeatedly writing window.onload=function(){} will be overwritten, that is, there can only be one window.onload;
  • jquery, the entry function will not be overwritten;

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326072362&siteId=291194637
Recommended