blob: 0bb3327693536e37f44c11bbe9f3eaf24b7cc766 [file] [log] [blame]
<!DOCTYPE html>
<title>MathQuill Quickstart</title>
<link rel="stylesheet" type="text/css" href="build/mathquill.css">
<p>Static math span: <span id="static-math">x = \frac{ -b \pm \sqrt{b^2-4ac} }{ 2a }</span>
<p>Editable math field: <span id="math-field">x^2</span></p>
<p>LaTeX of what you typed: <code id="latex">x^2</code></p>
<p><a href="">MathQuill&rsquo;s Getting
Started Guide</a></p>
<script src=""></script>
<script src="build/mathquill.js"></script>
var staticMathSpan = document.getElementById('static-math');
var mathFieldSpan = document.getElementById('math-field');
var latexSpan = document.getElementById('latex');
var MQ = MathQuill.getInterface(2); // keeps the API stable
// easily create static or editable math from a DOM element by calling the
// appropriate constructor:
// you may pass in an options object:
var mathField = MQ.MathField(mathFieldSpan, {
spaceBehavesLikeTab: true, // an example config option, for more see:
handlers: {
edit: function() {
// retrieve, in LaTeX format, the math that was typed:
latexSpan.textContent = mathField.latex();