I'm currently trying to implement MathQuill in a project that I'm working on. I installed the package via NPM (npm install mathquill
) and put the following <script>
s in the <head>
:
<script src="../node_modules/jquery/dist/jquery.min.js"></script>
<script src="../node_modules/mathquill/build/mathquill.js"></script>
When I load the page, however, I get an error message in Chrome's Dev Tools Console saying
Uncaught TypeError: Cannot read property 'prototype' of undefined
at P (mathquill.js:157)
at mathquill.js:254
at mathquill.js:4982
P @ mathquill.js:157
(anonymous) @ mathquill.js:254
(anonymous) @ mathquill.js:4982
I've looked at other people having similar problems, but none are having the problem I did and I can't seem to resolve it. How should I fix it?
Edit:
I figured out the problem. While the docs says JQuery 1.5.2+, it seems to break on whatever the latest version is. I just took the link that they used on their site and it seemed to have worked.
Not sure what was your exact problem but it seems the node package was last updated quite a few years back. Also, the default version of cdnjs points to version 0.9.x which is giving a similar error.
Using the latest version solved the problem. Here is a codepen with a working example.
Also, it doesn't seem to be related to the jQuery version as I used: 3.6.0 and it still works.