How can I detect DOM ready and add a class without jQuery?

后端 未结 8 1387
独厮守ぢ
独厮守ぢ 2020-11-28 06:04

I want to rewrite this line without using jQuery so it can be applied quicker (and before the downloading of the jQuery library). The line is...

$(document).         


        
8条回答
  •  醉话见心
    2020-11-28 06:50

    Simple:

    window.onload = function() {
      document.body.className = "javascript";
    }
    

    Or in HTML:

    ...
    

    Unless you want to differentiate between "before onload" and "after onload", you can do it statically:

    ...
    

提交回复
热议问题