jQuery best practices in case of $('document').ready

前端 未结 9 1304
孤街浪徒
孤街浪徒 2020-12-07 11:35

I was researching on jQuery best practices and found this article by Greg Franko

Normally, I do:

$(\"document\").ready(function() {
    // The DOM i         


        
9条回答
  •  轮回少年
    2020-12-07 11:53

    Based in Jquery documentation:

    All three of the following syntaxes are equivalent:
    
    $(document).ready(handler)
    $().ready(handler) (this is not recommended)
    $(handler)
    

    http://api.jquery.com/ready/

提交回复
热议问题