What is the difference between onLoad, onDomready, No wrap - in <head>, and No wrap - in <body>?

前端 未结 5 1732
没有蜡笔的小新
没有蜡笔的小新 2020-12-06 05:46

I use JSFiddle for editing my code. However, in certain codes when I\'m running JavaScript or jQuery, it doesn\'t work unless I select \"No wrap -

5条回答
  •  一个人的身影
    2020-12-06 06:24

    onLoad:

    • This means wrap the code so it will run in onLoad window event. This runs when the entire page has loaded (such as images).

    onDomReady:

    • This means to wrap the code so it will run in onDomReady window event. This runs when the DOM has loaded.

    no wrap - in :

    • This will place your JavaScript code in the section

    no wrap - in :

    • This will place your JavaScript code in the section

    I would like to note that more information can be found in jsFiddle's documentation.

提交回复
热议问题