InnerHTML with special character is trimming the data.
elem.innerHTML = displayedObjects.name;
here the displayedObjects.name contains a string like Test&string. The above statement is assigning the value only Test,
What could be done here?
That's because
Test&stringisn't actually valid HTML, because&is an escape character for an HTML entity. If it were properly encoded, it would beTest&stringinstead.If you're just trying to set the text of an element, I'd suggest you use
innerTextinstead: