Jqmath not loading correctly

2019-03-01 16:01发布

I have included the following on my html page:

<link rel="stylesheet" href="../css/jqmath-0.4.3.css"> 
<script src="../js/jquery-1.12.1.min.js"></script>
<script src="../js/jqmath-etc-0.4.3.min.js"></script>
<script>M.MathPlayer = false; M.trustHtml = true;</script>

But when the page loads i see the following error in Javascript console:

jqmath-etc-0.4.3.min.js:3 Uncaught SyntaxError: Invalid regular 
expression: /(\d+\.?\d*|\.\d+)|[\\`]([A-Za-z]+|.)|[�-�][�-�]|
\S[Ì€-ͯ᷀-á·¿âƒ-âƒ¿ï¸ -︯]*/: Range out of order in character class

I am using jqmath-etc-0.4.3.min.js with jquery-1.12.1.min.js.
What am i missing here or could this be a version incompatibility issue?
jqmath 0.4.3 is the only version that seems to be available.

2条回答
神经病院院长
2楼-- · 2019-03-01 16:39

Change your second <script> element to:

<script src="../js/jqmath-etc-0.4.3.min.js" charset="utf-8"></script>

As alljamin suggests, you'll see basically this in COPY-ME.html. The key is the charset="utf-8", required if you don't have a <meta charset="utf-8"> in your html file (but you probably really should).

查看更多
倾城 Initia
3楼-- · 2019-03-01 17:00

I was getting the same error as you did with your code.

If you download jqMath and open the COPY_ME.html in the downloaded folder, you should be able to see the structure of the html and how to make changes to it. Everything works fine there.

The example provided on jqMath official website uses jQuery 1.4.3 and your example uses jQuery 1.12.1, I am not sure but that could be the issue.

I hope this helps.

查看更多
登录 后发表回答