html not showing up in Quiz html editor

html not showing up in Quiz html editor

by Dave Johnson -
Number of replies: 2

I want to place a third party calculator into my questions. When I paste the code into the html editor, it is not showing up. When I go back into the editor, the upper part of the code has disappeared (everything above the URL link). I have tried pasting the code into an html practice board, and found it works fine. What am I missing? Thanks for your help. (Example of the code)

<!DOCTYPE html>
<html>
<head>
  



  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">

  <script src="https://www.desmos.com/api/v1.1/calculator.js?apiKey=dcb31709b452b1cf9dc26972add0fda6"></script>


</head>
<body>
  <div id="calculator" style="width: 350px; height: 450px;"></div>

  <script >
    var elt = document.getElementById('calculator');
    var calculator = Desmos.FourFunctionCalculator(elt);
  </script>
  


</body>
</html>

Average of ratings: -
In reply to Dave Johnson

Re: html not showing up in Quiz html editor

by Dominique Bauer -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

In the ressources and activities, Moodle allows to add content only in the <body> part of the html pages, not in the <head> part.

Anyway, for the Desmos Four Function calculator, you only need to include the following::

<iframe src="https://www.desmos.com/fourfunction" width="300px" height="400px" style="border: 1px solid #ccc" frameborder="0"></iframe>

Adjust the width and height according to your needs.

Average of ratings: Useful (2)
In reply to Dominique Bauer

Re: html not showing up in Quiz html editor

by Dave Johnson -

Dominique,

Thanks for your help with this. It is working fine now, and I am using both the Four Function and Four Function with Percent calculators. Prior to your info, I did try changing the code from script to iframe; however, the interior code (I got from the Desmos website) did not function properly with their API key in the line. So, I am uncertain why they have it that way. I guess the calculators may be used by setting up access via repository. Using iframe  and the html editor is easier.

Thanks, again.

Dave