Search code examples
jquerymathjax

I need to change the color and style of mtext elements in jquery


¿Has anybody tried to access the "mtext" elements generated by MathJax.js library from jquery?

I have something like this:

<mrow>
   <mo>(</mo>
       <mtext>Producción‌·de‌·naranjas&nbsp;&nbsp;</mtext>
   <mo>)</mo>
</mrow>

but i cant select any mtext element. I tried using $('mtext').addClass('red') but it didnt work.

Thanks


Solution

  • It works for me using the same code as you: $('mtext').addClass('red');.

    Perhaps you are not waiting until the markup has actually been loaded/added to the DOM before running the jQuery selector? That would prevent jQuery from finding any elements to add the class to.