I have a span id with textContent which have their own time(hour/minutes)
<div class="here">
<span class="time" >8 min</span>
</div>
<div class="here">
<span class="time" >22 min</span>
</div>
<div class="here">
<span class="time" >38 min</span>
</div>
<div class="here">
<span class="time" >1 hour</span>
</div>
<div class="here">
<span class="time" >1 day</span>
</div>
How can we show the span text whose time is less then 60 min, i don’t want to show the text of span which contains 1 hour or 1 day any way to do that and yes string with number is necessary for my project.
>Solution :
const els = document.querySelectorAll(".time")
els.forEach(el => {
if (/(hour)|(day)/.test(el.textContent)) el.style.display = "none"
})
<div class="here">
<span class="time">8 min</span>
</div>
<div class="here">
<span class="time">22 min</span>
</div>
<div class="here">
<span class="time">38 min</span>
</div>
<div class="here">
<span class="time">1 hour</span>
</div>
<div class="here">
<span class="time">1 day</span>
</div>