How check if body has a specific class with JavaScript?

后端 未结 7 1856
不思量自难忘°
不思量自难忘° 2021-01-01 16:40

How can I check if body has specific class? This is my case:


相关标签:
7条回答
  • 2021-01-01 17:22

    There's now a super-easy way to do this:

    document.body.classList.contains('my-class-name')
    
    0 讨论(0)
提交回复
热议问题