Reputation: 21
I want to be able to put a LaTeX math equation into an input tag or a textarea, but inputting an equation using Mathjax syntax just gives the same equation back.
I tried something like:
<script type="text/javascript" async
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?
config=TeX-MML-AM_CHTML"> </script>
<input type = "text" value = "$$\frac{2}{2}$$" />
<div>
$$\frac{2}{2}$$
</div>
But this just prints $$\frac{2}{2}$$ in the input box. I want the text inside the input to appear like a regular fraction, like it does in the div.
Edit: I found that the best way to put equations into a text box like this is to use something called Mathquill.
Upvotes: 2
Views: 1628
Reputation: 1885
As far as I know, you cannot do that. The <input>
element is for plain-text.
The HTML doesn't allow to write there, so, MathJax
cannot render the equation.
A possible workaround is to show what you want in a small
tag, for example:
<input type = "text" />
<small>
Example: $$\frac{2}{2}$$
</small>
Upvotes: 2