I am new to typescript. I have a question of displaying html using typescript. Below is my HTML code:
<div itemprop="copy-paste-block">
<ul>
<li><span style="font-size:11pt;"><span style="font-family:Calibri,sans-serif;">ITS – signed support agreement</span></span>
<ul style="list-style-type:circle;">
<li><span style="font-size:11pt;"><span style="font-family:Calibri,sans-serif;">27 parts received to date.</span></span>
</li>
<li><span style="font-size:11pt;"><span style="font-family:Calibri,sans-serif;">Working larger structures package.</span></span>
</li>
</ul>
</li>
<li><span style="font-size:11pt;"><span style="font-family:Calibri,sans-serif;">GECAS </span></span>
<ul style="list-style-type:circle;">
<li><span style="font-size:11pt;"><span style="font-family:Calibri,sans-serif;">Working full ship set structures package.</span></span>
</li>
</ul>
</li>
<li><span style="font-size:11pt;"><span style="font-family:Calibri,sans-serif;">Skywest</span></span>
<ul style="list-style-type:circle;">
<li><span style="font-size:11pt;"><span style="font-family:Calibri,sans-serif;">Price rationalization presented to mgmt.</span></span>
</li>
</ul>
</li>
<li>United
<ul style="list-style-type:circle;">
<li><span style="font-size:11pt;"><span style="font-family:Calibri,sans-serif;">Single Radome oppty.</span></span>
</li>
</ul>
</li>
</ul>
</div>
And when I use
document.write(htmlcontent);
It displays correct as show here:
However, when I use
document.body.innerHTML = htmlcontent
The display was changed, missing some contents and changed some formats shown below
I wonder if this is what supposed to happen....and if there anything I should do to make body.innerHTML display correctly? Thanks.
This link didn't answer my question: When should one use .innerHTML and when document.write in JavaScript