string.replace against html symbol code (÷)? |
string.replace against html symbol code (÷)? |
CharliePrince |
Jan 9 2021, 03:38 AM
Post
#1
|
Novice Group: Members Posts: 24 Joined: 7-November 20 From: Saint Louis, MO Member No.: 27,623 |
I'm trying to replace an html symbol code '÷' with another string.
I can't get this to work. See example below. CODE <body> <p id='target'>A ÷ B</p> <script> console.log(`${document.getElementById('target').innerText}`); console.log(`${document.getElementById('target').innerText.replaceAll('รท', '/')} (want this to = 'A / B') `); console.log(`${document.getElementById('target').innerText.replaceAll('÷', '/')} (or, want this to = 'A / B') `); </script> </body> Can anyone help? Pandy? |
Lo-Fi Version | Time is now: 25th May 2024 - 06:39 AM |