LoginSignup
1
0

More than 3 years have passed since last update.

MathJaxで動的な変化を追加するにはTypesetを用いる

Posted at

onclickで数式を表示したい

以下で実現できる。

    const math = document.getElementByID('math');
    btn.onclick = function() {
      math.textContent = '$x + 1$';
      MathJax.Hub.Typeset(math);
    }

MathJax.Hub.Typesetがないとただ

x + 1

と表示されるだけ。

MathJax.Hub.Typesetを記述すれば

$x + 1$

と表示される。

参考記事

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0