问题
i'm having problem when i want to select element using querySelector
<ul class="xoxo blogroll">
</ul>
how i can select that ul
element, in my code i'm use like this
var list = document.body.querySelector('ul[class="oxo blogroll"]');
alert(list.innerHTML);
but the return is null
,i'm sure element ul with class xoxo blogroll
is defined...
thanks for your answer..
回答1:
document.body.querySelector("ul.xoxo.blogroll")
And that is it...
回答2:
Try this:
document.body.querySelector('ul.xoxo.blogroll')
来源:https://stackoverflow.com/questions/8847247/how-i-can-select-element-with-double-class-with-queryselector