JQ初始化方法实际上有两种,由于美元符号可以定义 jQuery,那么就有三种方法可以进行初始化操作,根据个人习惯来选择吧!

  • 第一种
$(document).ready(function(){
   // jQuery methods go here...
});
  • 第二种
$(function(){
   // jQuery methods go here...
});
  • 第三种
jQuery(function($) {
     //jQuery methods go here ...  
});

 

如果$美元符号和其它组件有冲突,可以用var j = jQuery.noConflict();  其进行定义。

 

相关文章:

  • 2021-11-28
  • 2022-12-23
  • 2021-12-28
  • 2021-11-28
  • 2021-11-06
  • 2021-11-06
  • 2021-09-02
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-28
  • 2022-12-23
  • 2021-05-21
  • 2021-11-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案