Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: hide correct

  1. #1
    New to the CF scene
    Join Date
    Mar 2017
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    hide correct

    document.getElementById('1').innerHTML = 'correct';
    } else {
    document.getElementById('1').innerHTML = 'incorrect';
    }

    how can i hide correct and incorrect after they submit answer

  2. #2
    Senior Coder deathshadow's Avatar
    Join Date
    Feb 2016
    Location
    Keene, NH
    Posts
    3,427
    Thanks
    4
    Thanked 488 Times in 476 Posts
    You really didn't provide enough code for anyone to answer, but unless you've written it with AJAX, if they are ACTUALLY submitting it should be a new page-load, so what exactly is there to "hide" since its a fresh page?

    Even if doing it with AJAX, not sure why you'd not have flushed the question for a new one -- assuming (and this is a wild guess) this is a questionnaire of some sort.

    Even so, remember the basic rule of using JavaScript for things like this, write the page to work without the JavaScript FIRST, THEN enhance it with scripting... so you should have the page-load and server-side mechanism in place already.

    Well, unless you did something silly like placed the answers client-side and are completely handling correct/incorrect from the JavaScript, in which case I'd LOVE to take one of your tests since I could get a 100 every time, even if I were completely illiterate on the topic.

    Laughably I've come across a LOT of 'fun questions' trivia/quiz sites lately that do exactly that. One simple userscript and you get the right answer on every question every time. "Security, what's that then?!?"
    “There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies and the other way is to make it so complicated that there are no obvious deficiencies.” – C.A.R. Hoare, The 1980 ACM Turing Award Lecture
    http://www.cutcodedown.com


 

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •