In one function of my site, the inner HTML of a div element is changed to include a right arrow. This symbol is included in the innerHTML of "myDiv" as ➞
In a separate function, I am trying to match the innerHTML of "myDiv" with ➞
function myFunction() {
//Many lines of code then
var myText = document.getElementById("myDiv").innerHTML;
alert(myText);
if (myText.match(/➞/g)) { //also tried with /➞/g
alert('Yep');
myText = myText.replace(/➞/g, " to yield ");
}
//Many more lines
}
When I alert myText as in the function above (before the if statement), the alerted output contains an actual right arrow ➞, not ➞ The problem is that even though ➞ is present in the code to produce the innerHTML of "myDiv" in the first place (in a separate function), in myFunction()
➞ does not seem to match, since the alert('Yep') is not called.
I looked up and in desperation tried decodeURIComponent() but I was pretty sure this was not going to work and it seemed not to. Can anyone help with this problem? Thanks