关于作者

Discuss / JavaScript / 使用了css选择器

使用了css选择器

Topic source

赤_子

#1 Created at ...
// 选择<p>JavaScript</p>:
var js = document.querySelector("#test-p");

// 选择<p>Python</p>,<p>Ruby</p>,<p>Swift</p>:
var arr = document.querySelectorAll(".c-red.c-green > p");

// 选择<p>Haskell</p>:
var haskell = document.querySelectorAll(".c-green > p")[4];

  • 1

Reply

WARNING: You are using an old browser that does not support HTML5. Please choose a modern browser (Chrome / Microsoft Edge / Firefox / Sarafi) to get a good experience.