This is kind of a dumb question to ask, but can you take an html text and use it as a string in js | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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 Answers
+ 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