How check if body has a specific class with JavaScript?

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

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


7条回答
  •  抹茶落季
    2021-01-01 17:16

    This returns a string of true or false when looking for a specific body class using jQuery's .hasClass:

    $("body").hasClass("your-class-name").toString();
    

提交回复
热议问题