Javascript in HTML question type


  • administrators

    There are a few problems with the HTML question type javascript box, such as:

    • Cannot be resized
    • Cannot use single line comments
    • Cannot ignore semi-colons
    • Cannot use $ for jQuery

    One way around all these problems is to save your javascript as a .js file and upload it to the MapleTA site and then include it in the question with (inside the initialize function)

    jQuery.getScript("LOCATION_OF_YOUR_JS_FILE", function() {...});
    

    Where inside the function(){...} you can use any functions defined in your file.


  • administrators

    It is worth mentioning that by default .js files are not an allowed file type in Maple T.A.. You should speak to support@maplesoft.com about getting .js added to the list of allowed file types on your instance of Maple T.A.


  • administrators

    @jmtrik If .js files are not allowed, you can get around this by uploading them as .txt and linking to those.


Log in to reply