How to remove a class from elements in pure JavaScript?

后端 未结 6 635
[愿得一人]
[愿得一人] 2020-11-30 03:07

I would like to know how to select all elements with class names \"widget\" and \"hover\" and then remove class \"hover\" from these elements.

I have the following J

6条回答
  •  日久生厌
    2020-11-30 03:16

    Given worked for me.

    document.querySelectorAll(".widget.hover").forEach(obj=>obj.classList.remove("hover"));
    

提交回复
热议问题