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

后端 未结 8 1330
独厮守ぢ
独厮守ぢ 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 07:02

    just put this

    <script>document.body.className += ' javascript';</script>
    

    before </body> tag. Simple and easy (and very close) solution.

    0 讨论(0)
  • 2020-11-28 07:03

    I dont know about vanilla JS, but you can write:

    document.getElementsByTagName('body')[0].className += ' javascript';
    

    at the bottom of the page (before closing the body tag).

    0 讨论(0)
提交回复
热议问题