$(document) vs. $(“document”)

后端 未结 4 1086
北恋
北恋 2020-12-06 11:44

Is there any difference between: $(document) and $(\"document\")?

EDIT: also when into the .ready() e.g. $(\"document\")

4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-06 11:49

    Your first example wil search for an variable or object called document within your JS. (be carefull, it is a predefined variable)

    The second will search the page for a tag with the name "document".

    var document = 'div#logo';
    $(document); //will search for div#logo
    $('document'); //will search for document
    

提交回复
热议问题