如何为JavaScript编写类?
这是我的班级:如何为JavaScript编写类?,javascript,html,Javascript,Html,这是我的班级: .yt-card.yt-uix-expander .yt-uix-button-expander, .yt-card .yt-uix-expander .yt-uix-button-expander 有没有办法把它写得漂亮点: document.getElementsByClassName("class"); 你说的“写得漂亮”是什么意思?这并不是一个类(甚至不是很接近)将类更改为一个单词lol,而且代码中有多个类不仅仅是多个类,更糟糕的是-它是一个多部分选择器,其中每个部分
.yt-card.yt-uix-expander .yt-uix-button-expander, .yt-card .yt-uix-expander .yt-uix-button-expander
有没有办法把它写得漂亮点:
document.getElementsByClassName("class");
你说的“写得漂亮”是什么意思?这并不是一个类(甚至不是很接近)将类更改为一个单词lol,而且代码中有多个类不仅仅是多个类,更糟糕的是-它是一个多部分选择器,其中每个部分用多个类或多个元素命名元素。这个问题毫无意义。我知道,所以我在问。以“…”号填列;我不能有点,但是。yt卡。yt uix扩展器。。。我能用它做什么?或者更简单。如何将:.yt-card.yt-uix-expander.yt-uix按钮扩展器放入document.getElementsByClassName?
var matches = document.querySelectorAll(
".yt-card.yt-uix-expander .yt-uix-button-expander, .yt-card .yt-uix-expander .yt-uix-button-expander");