Browser throwing error on included javascript


This should be trivial - trying to include a javascript library in a blog post. The trouble seems to be with

<div id="box" class=..."></div>
<script type="text/javascript">
 var board = JXG.JSXGraph.initBoard('box', ... )

Now I know that JXG is being loaded properly, but the single quotes around 'box' in the third line are turned into


in the HTML page generated by Hugo, and the browser (both Chrome and Firefox) complains about an illegal character. I would have thought that the <script type="text/javascript"> would ensure that all commands in the script would be fed without change into the javascript library for processing, but it seems that even within this script, some string-to-HTML conversion is being done.

How can I ensure that all commands inside <script> ... </script> are fed to javascript precisely as written?

(Note to moderators: this is very similar to a question I’ve asked in another topic; I’m creating a new topic in the hope of finding some more people who might be managing this issue themselves.)



Thank you very much - but an even easier way was to wrap the whole box and dice in a single <div></div> tags:

<div id="box" class="jxgbox" style="width:500px; height:500px;">
<script type="text/javascript">
 var board = JXG.JSXGraph.initBoard('box', {boundingbox: [-10, 10, 10, -10],axis:true});
 var p = board.create('point',[1,1]);