+ 1

This is kind of a dumb question to ask, but can you take an html text and use it as a string in js

<div> <span> $100 </span> </div> Can I somehow get span through js, and remove the $ (dollars sign, or any other text)?

9th Jan 2020, 3:01 AM
Ginfio
Ginfio - avatar
2 odpowiedzi
+ 6
Yes, let spn=document.querySelector('span'); spn.innerText=spn.innerText.replace('
#x27;,''); instead of calling it a dumb question you can add more description by editing .just for your own benifit. 👀
9th Jan 2020, 3:15 AM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar
+ 3
🇮🇳Omkar🕉 Ok. Thanks. I said dumb, cuz I was thinking... “How is this even possible.. this is kind of dum*”. —
9th Jan 2020, 8:40 PM
Ginfio
Ginfio - avatar