Hi,
In my javascript code I am checking for a match of the inner HTML of a anchor tag which subsequently, if it matches, the inner HTML will be changed.
Normally this works perfectly, however this time I have a HTML chracter code in the inner HTML of the anchor tag and it would appear that javascript cannot match or read HTML character codes?
What I have is:
JavaScript
HTML
If I remove the HTML character code » (for » btw) in the HTML and the JS it works perfectly and if I replace the character code in the JS with » it still doesnt work.
It is almost like JS cannot detect character codes in the HTML or JS is reading the renderd page yet still doesnt understand the » character.
Can anyone help?
Cheers
In my javascript code I am checking for a match of the inner HTML of a anchor tag which subsequently, if it matches, the inner HTML will be changed.
Normally this works perfectly, however this time I have a HTML chracter code in the inner HTML of the anchor tag and it would appear that javascript cannot match or read HTML character codes?
What I have is:
JavaScript
Code:
var nme = this.id;
var d = document.getElementById(nme);
if(d.innerHTML == "Show Description »")
{
d.innerHTML = "« Hide Description";
}
HTML
Code:
<a id="hideshow" href="#">Show Description »</a>
If I remove the HTML character code » (for » btw) in the HTML and the JS it works perfectly and if I replace the character code in the JS with » it still doesnt work.
It is almost like JS cannot detect character codes in the HTML or JS is reading the renderd page yet still doesnt understand the » character.
Can anyone help?
Cheers