Can't use the script tag in blog post HTML editor. Keeps commenting my code out.

FitPhilosophy
Tourist
5 1 0

I'm trying to imbed Javascript in one of my blog articles, but each time I paste it into the HTML editor, it gets auto commented out. I'm seeing guides all over suggesting that I should be able to use javascript in the HTML editor. What could be the problem?

For example, I'm trying to imbed this test calculator code into my blog: 

<div class="calconic-calculator" data-calculatorid="5f581874a6a5010029339863"></div>

<script>

(function() { var qs,j,q,s,d=document, gi=d.getElementById,

ce=d.createElement, gt=d.getElementsByTagName,

id="calconic_", b="https://cdn.calconic.com/static/js/";

if(!gi.call(d,id)) { j=ce.call(d,"script"); j.id=id; j.type="text/javascript"; j.async=true;

j.dataset.calconic=true;

j.src=b+"calconic.min.js"; q=gt.call(d,"script")[0]; q.parentNode.insertBefore(j,q) }

})();

</script>

 

But every time I save it, it becomes

 

<script>// <![CDATA[

(function() { var qs,j,q,s,d=document, gi=d.getElementById,

ce=d.createElement, gt=d.getElementsByTagName,

id="calconic_", b="https://cdn.calconic.com/static/js/";

if(!gi.call(d,id)) { j=ce.call(d,"script"); j.id=id; j.type="text/javascript"; j.async=true;

j.dataset.calconic=true;

j.src=b+"calconic.min.js"; q=gt.call(d,"script")[0]; q.parentNode.insertBefore(j,q) }

})();

// ]]></script>

 

Notice it gets commented out by the "// <!" section.

I even tried to create a new page template and added the following code to the .liquid file and even that doesn't appear to work at all either


<div class="calconic-calculator" data-calculatorid="5f581874a6a5010029339863"></div>
<script>
(function() { var qs,j,q,s,d=document, gi=d.getElementById,
ce=d.createElement, gt=d.getElementsByTagName,
id="calconic_", b="https://cdn.calconic.com/static/js/";
if(!gi.call(d,id)) { j=ce.call(d,"script"); j.id=id; j.type="text/javascript"; j.async=true;
j.dataset.calconic=true;
j.src=b+"calconic.min.js"; q=gt.call(d,"script")[0]; q.parentNode.insertBefore(j,q) }
})();
</script>

 

0 Likes