When attempting to load a div
tag using the .append()
method, the styles are not loading correctly. Here's the code that was tested:
<section id="year-2020" class="tab-panel">
<div class="row accordion">
<header>
<h3>2019 4th Quarter and Annual Results Conference Call</h3>
<p>February 27, 2020</p>
</header>
<ul>
<li>
<a href="http://services.choruscall.ca/links/husky20191202.html" target="_blank">
<strong>4th Quarter Conference Call</strong>
</a>
</li>
<li>
<a href="/downloads/InvestorRelations/2020/2020GuidanceChart.pdf" target="_blank"><strong>2020 Guidance Chart</strong> (PDF)</a>
</li>
</ul>
</div>
</section>
This code produces the following output: https://i.stack.imgur.com/7kMNB.png
When trying to add the same div
through .append()
like below:
var el = $(' <div class="row accordion ui-accordion ui-widget ui-helper-reset"><header><h3>2019 4th Quarter and Annual Results Conference Call</h3><p>February 27, 2020</p></header><ul><li><a href="http://services.choruscall.ca/links/husky20191202.html" target="_blank"> <strong>4th Quarter Conference Call</strong></a></li><li><a href="/downloads/InvestorRelations/2020/2020GuidanceChart.pdf" target="_blank"><strong>2020 Guidance Chart</strong> (PDF)</a></li></ul></div>');
$('#year-2020').append(el);
It resulted in the following output: https://i.stack.imgur.com/gJCEM.png
The +
accordion is being removed. If both the html
and jQuery
code are the same, it should load the same as the html
, but it's not happening. Please assist me in resolving this issue as I have been struggling for 2 days.
Thank you in advance.
P.S : I've tried without using var el=..
in jQuery
Here is the JSFiddle