javascript中的querySelector()和querySelectorAll()
2014-06-25 22:23
549 查看
//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]");
浏览器支持度
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及更高 |
相关文章推荐
- javascript高级选择器querySelector和querySelectorAll
- 浅谈JavaScript高级选择器querySelector和querySelectorAll
- javascript的querySelectorAll()和querySelector()
- JavaScript高级选择器querySelector和querySelectorAll
- javascript DOM扩展querySelector()和和querySelectorAll()
- javascript高级选择器querySelector和querySelectorAll全面解析
- javascript高级选择器querySelector和querySelectorAll
- javaScript中的querySelector()与querySelectorAll()的区别
- javascript高级选择器querySelector和querySelectorAll
- javascript高级选择器querySelector和querySelectorAll
- javascript高级选择器querySelector和querySelectorAll
- javascript高级选择器querySelector和querySelectorAll全面解析
- IE6、IE7兼容querySelectorAll和querySelector方法-最终版本
- javascript 高级选择器:querySelector 和 querySelectorAll
- 关于querySelector()与querySelectorAll()的在ie下的一点与众不同之处。
- javascript之querySelector和querySelectorAll使用介绍
- 各浏览器中querySelector和querySelectorAll的实现差异分析
- javascript之querySelector和querySelectorAll使用说明
- 各浏览器中querySelector和querySelectorAll的实现差异分析
- querySelector和querySelectorAll