Button only on initial load updating value

Thread is closed for posting
2 posts, 0 answers
  1. Jonas
    Jonas avatar
    1 posts
    Member since:
    Apr 2013

    Posted 23 Apr 2013 Link to this post


    I'm trying to change the value of a button based on JS. Essentially, every time I load the page the values should change. My code is:

        if (correctOption == 3)
            document.getElementById('option3').value = num1 + num2;
            document.getElementById('option3').value = Math.floor((Math.random()*200)+1);

    For the initial run everything looks fine but during subsequent runs the value does not update. Any idea what I'm doing wrong? (I'd rather not use jQuery at this point to reduce overhead). Thanks!
  2. David Silveria
    David Silveria avatar
    234 posts
    Member since:
    May 2006

    Posted 23 Apr 2013 Link to this post

    Does this code work from a regular browser on your desktop? Where is it invoked, do you use deviceready event?

Back to Top