JSFiddle - React, Tailwind, and code Playground
HTML
<html>
<head>
<title>MathJax Test</title>
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
<script>
MathJax = {
tex: {
inlineMath: [['$', '$'], ['\\(', '\\)']]
}
}
</script>
<script type="text/javascript" id="MathJax-script" async
src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js">
</script>
</head>
<body>
<div id="div1">
</div>
</body>
</html>
JavaScript
window.addEventListener('DOMContentLoaded', (event) => {
var para = document.createElement("p");
var element = document.getElementById("div1");
setTimeout(() => {
para.innerText = '$x=x^2+1$'
element.appendChild(para)
}, 500)
})