问题
I have just started using querySelector
. I want to get the text data of first non empty element without concerning the element name (p or div or span).
For example: 1)
<div>
<span></span>
<span>data</span>
<span>data1</span>
<div>
2)
<div>
<ul>
<li></li>
<li>data</li>
</ul>
<span>data1</span>
<div>
In both the cases I want to get the text data of first element that is non empty. In 1 case from the second span
and in 2 case from the second li
. Is that possible?
来源:https://stackoverflow.com/questions/43607844/is-there-any-way-to-get-the-text-data-of-first-non-empty-element-using-query-sel