Search code examples
javascriptmathquill

How to handle multiple mathquill elements in single page


I need to handle multiple mathquill input boxes at the same time in single page application. I didnt able to found any implementation of this also. So, is it possible to use multiple mathquill elements and how.


Solution

  • you can do it downloading the following plugin

    https://www.jqueryscript.net/text/Simple-WYSIWYG-Math-Editor-With-jQuery-Mathquill-matheditor-js.html

    and following these steps:

    1) include scripts and css

    <script src="//code.jquery.com/jquery.min.js"></script>
    <script src="mathquill.min.js"></script>
    <script src="/matheditor.js"></script>
    
    <link href="mathquill.css" rel="stylesheet">
    <link href="matheditor.css" rel="stylesheet">
    

    2) include multiple mathquill

    <body>
     <div id="demo1"></div>
     <div id="demo2"></div>
     <div id="demo3"></div>
     <div id="demo4"></div>
    
    <script type="text/javascript">
      var demo1 = new MathEditor('demo1');
      var demo2 = new MathEditor('demo2');
      var demo3 = new MathEditor('demo3');
      var demo4 = new MathEditor('demo4');
    </script>
    </body>