1.0.6 • Published 6 years ago

input-math v1.0.6

Weekly downloads
1
License
ISC
Repository
github
Last release
6 years ago

#inputMath

jQuery plugin to evaluate the written expression on every Enter, like blender

Visit the test page at levhita.github.io/inputMath

Usage

Browser

Include it after the jQuery definition in your HTML:

<script src="node_modules/input-math/dist/inputMath.js"></script>

Then you can attach the inputMath evaluator using:

$('.input-math').inputMath();

For an example inputtype=text.input-math:

    <input type="text" class="input-math"/>

Then on every keyup it'll check for an enter and then evaluate the expression.

Node

Install with npm install input-math, you will need to install jQuery and JSDOM to be able to run it in node npm install jsdom jquery, then use the following template to create a fake DOM for jQuery to work

var jsdom = require('jsdom');
const { JSDOM } = jsdom;
const { window } = new JSDOM();
const { document } = (new JSDOM('')).window;
global.document = document;
var jQuery = require('jquery')(window);
const $ = require('input-math')(jQuery);

console.log($.fn.mathEval('2+2'));
1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago