Answer the question
In order to leave comments, you need to log in
How to get tag value without nested tag value?
All good afternoon!
We have the following structure:
<span class="price">
<span class="currencySymbol">₽</span>
210.00
</span>
document.querySelectorAll('.price');
Answer the question
In order to leave comments, you need to log in
var priceEl = document.querySelector('.price');
var matches = priceEl.textContent.match(/[0-9.]+/);
var price = Number(matches[0]);
console.log(price);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question