九州体育网 - 十年信誉网站

关于作者

Discuss / JavaScript / 练习-选择出指定条件的节点

练习-选择出指定条件的节点

Topic source

心如止水0828

#1 Created at ...
// 选择<p>JavaScript</p>:
var js = document.getElementById('test-p');
// 选择<p>Python</p>,<p>Ruby</p>,<p>Swift</p>:
//var arr = document.getElementsByClassName('c-red c-green')[0].children;
var arr = document.querySelectorAll('.c-red.c-green > p');
// 选择<p>Haskell</p>:
var haskell = document.getElementById('test-div').lastElementChild.lastElementChild;

  • 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.