How check if body has a specific class with JavaScript?

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

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


7条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-01 17:15

    document.getElementsByTagName("body")[0].className.match(/foo/)
    

提交回复
热议问题