Innerhtml With Special Character Is Trimming The Data
InnerHTML with special character is trimming the data. elem.innerHTML = displayedObjects.name; here the displayedObjects.name contains a string like Test&string. The above sta
Solution 1:
That's because Test&string
isn't actually valid HTML, because &
is an escape character for an HTML entity. If it were properly encoded, it would be Test&string
instead.
If you're just trying to set the text of an element, I'd suggest you use innerText
instead:
elem.innerText = displayedObjects.name;
Post a Comment for "Innerhtml With Special Character Is Trimming The Data"