On Oct 5, 2016, at 4:27 PM, richa...@gmail.com wrote:Hi.I've created a js file that picks some random MathJax from an array. For instance:var conjectures = ['\(n^3 + n\) is always even' . . . etc];I've then randomised printed it to html using jQuery$('.triangle-isosceles').html(randConjecture);Now this won't display in the correct format because MathJax has already done it's typesetting. I looked at the documentation and added another line below the function likeMathJax.Hub.Queue(["Typeset",MathJax.Hub]);but this isn't working. I assume I've typed in rubbish here, or the problem might be that I've called MathJax in my HTML file but my javascript file doesn't know how to deal with it?Can someone help me? I just want MathJax to look at the page again and re-render any code.I've added the code of my main file :and celeb.js
Enter code here..<!DOCTYPE html><html><head><link rel="stylesheet" type="text/css" href="celeb.css" /><link href="https://fonts.googleapis.com/css?family=Bungee+Shade|Slabo+27px|Open+Sans|Bungee" rel="stylesheet"><!--[if IE]><link href="http://fonts.googleapis.com/css?family=Bungee" rel="stylesheet" type="text/css"><link href="http://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet" type="text/css"><link href="http://fonts.googleapis.com/css?family=Slabo+27px" rel="stylesheet" type="text/css"><![endif]--><script type="text/javascript" async</script></head><body><script src='https://code.jquery.com/jquery-3.1.0.min.js'></script><script src='celeb.js'></script><div id="container"><a href="https://twitter.com/share" class="twitter-share-button" data-show-count="false">Tweet</a><script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script><p id='backto'><a href=http://www.ticktockmaths.co.uk>[Go Home]</a></p><p id="intro">These celebs have some thoughts. Do you agree? Can you prove or disprove them?</p><div class="triangle-isosceles">Click the celebrity to generate a conjecture.</div><div id="randomelement"><img src="Celebs/jedward.png" /></div><div></div></div></body></html>.
function main() {$('#randomelement').on('click', function () {var celeb = ['joey.jpg', 'justin.jpg', 'jedward.png', 'david.jpg', 'adam.jpg'];var randCeleb = celeb[Math.floor(Math.random() * celeb.length)];$('#randomelement').html('<img src="Celebs/' + randCeleb + '" />');var conjectures = ['\(n^3 + n\) is always even', 'All even numbers, apart from 2 can be expressed as the sum of two primes.', 'The square numbers follow the patter odd, even odd', '\(n^2 + n\) is always odd', '\(2^n - 1\) is always prime'];var randConjecture = conjectures[Math.floor(Math.random() * conjectures.length)];$('.triangle-isosceles').html(randConjecture);MathJax.Hub.Queue(["Typeset",MathJax.Hub]);} );}$(document).ready(main);Yes. This stupid little program pairs up stupid celebrities with maths conjectures for pupils to try and disprove/prove.Geek maths teacher.--
You received this message because you are subscribed to the Google Groups "MathJax Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mathjax-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.