How can I access child element's innerHTML which has no class nor ID through parent element with class in JavaScript?
It should return only text between <b> tags.
<div class="parent element">
<h5>
some other text<b>text</b>
</h5>
</div>
var innerText=document.querySelector('.parent.element h5 b').innerText
console.log(innerText);
<div class="parent element">
<h5>
some other text<b>text</b>
</h5>
</div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With