閱讀449 返回首頁    go 技術社區[雲棲]


javascript中的querySelector()和querySelectorAll()

//get the header ID element

document.querySelector("#header");


//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]");


瀏覽器支持度

IE 8.0及以上
Firefox 3.5及以上
chrome 1及更高
opera 10及更高
Safari 3.2及更高

最後更新:2017-04-03 06:03:03

  上一篇:go swing開發圖形界麵工具配置(可自由拖控件上去)
  下一篇:go 論參加技術培訓的弊端及如何識別培訓學校的騙局