I dont know why this is the case but my replace does not work. It is somehow unusual considering my syntax is correct.
info.textContent.replace('Title', "replaced");
where info is the variable that stores an element. It should actually replace all instances of Title with "replaced". I prefer not using innerText due to compatibility issues and innerHTML due to security risks. textContent is supported by firefox and I have no idea what is going on.
I would appreciate some insight. I am learning javascript and tips for best practice are welcome.
Below the full code in Jsfiddle:
http://jsfiddle.net/r7bL6vLy/123/
It works, it's just replace method returns new string you need to assign back:
info.textContent = info.textContent.replace('Title', "replaced");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With