zl程序教程

您现在的位置是:首页 >  前端

当前栏目

javascript中的querySelector()和querySelectorAll()

2023-09-14 09:00:25 时间

//get the first element with a dropcap class

document.querySelector(".dropcap");


//get all the paragraphs with a "dropcap" class produces a nodelist

document.querySelectorAll(".dropcap");


//get all elements with a class of "dropcap" or "huge"

document .querySelectorAll(".dropcap,.huge");


//get all paragraphs that hava a class

document.querySelectorAll("p[class]");


浏览器支持度