小编web*_*dia的帖子

JQuery最佳实践,在IIFE中使用$(document).ready?

我正在看一段代码:

(function($) {    
   // other code here    
 $(document).ready(function() {   
    // other code here    
  });    
})(jQuery);
Run Code Online (Sandbox Code Playgroud)

我虽然IIFE执行$(document).ready的功能,这段代码是否正确?或者我可以删除$(document).ready并将代码直接放在IIFE中.

jquery document-ready iife

26
推荐指数
2
解决办法
2万
查看次数

标签 统计

document-ready ×1

iife ×1

jquery ×1