I have Googled my brains out and can't figure out how to make this work. Here is what I'm trying to do:
HTML:
<div id=derp>"Hi, my name is.."</div>
Javascript:
var div = document.getElementById('derp');
alert(div.innerHTML);
alert(div.innerText);
alert(div.textContent);
All of those alerts interpret and return the "
as "
in the resulting string. I want to get the raw text with "
uninterpreted.
They all return:
"Hi, my name is.."
When I want to get:
"Hi, my name is.."
Is there a way to do this? Preferably without trying to use a regex to replace every instance of "
with "
.
It's kind of a long story of what I'm trying to do, but simply using replace() to search and replace every instance of "
would be a headache to implement because of other regex matching/parsing that needs to occur.
Thanks in advance for any Javascript wizards who can save my sanity!