Creating a Quiz with jQuery [closed]Tips and Suggestion on how to create a quiz using php and jQueryhow do i make automatically changing quiz in HTML (jquery maybe?)Is there an “exists” function for jQuery?Create GUID / UUID in JavaScript?Add table row in jQueryHow do I check if an element is hidden in jQuery?Setting “checked” for a checkbox with jQuery?Creating a div element in jQueryHow to check whether a checkbox is checked in jQuery?How to decide when to use Node.js?jQuery scroll to element“Thinking in AngularJS” if I have a jQuery background?

What is Cash Advance APR?

Electoral considerations aside, what are potential benefits, for the US, of policy changes proposed by the tweet recognizing Golan annexation?

Do the primes contain an infinite almost arithmetic progression?

Why does AES have exactly 10 rounds for a 128-bit key, 12 for 192 bits and 14 for a 256-bit key size?

Has any country ever had 2 former presidents in jail simultaneously?

Creepy dinosaur pc game identification

Why is the "ls" command showing permissions of files in a FAT32 partition?

Can I say "fingers" when referring to toes?

Can disgust be a key component of horror?

Can a College of Swords bard use a Blade Flourish option on an opportunity attack provoked by their own Dissonant Whispers spell?

What exact color does ozone gas have?

Quoting Keynes in a lecture

Why is this estimator biased?

Does Doodling or Improvising on the Piano Have Any Benefits?

Why should universal income be universal?

Calculating total slots

Why is it that I can sometimes guess the next note?

How to cover method return statement in Apex Class?

What is the highest possible scrabble score for placing a single tile

Does an advisor owe his/her student anything? Will an advisor keep a PhD student only out of pity?

Multiplicative persistence

What does "Scientists rise up against statistical significance" mean? (Comment in Nature)

What if a revenant (monster) gains fire resistance?

What are the advantages of simplicial model categories over non-simplicial ones?



Creating a Quiz with jQuery [closed]


Tips and Suggestion on how to create a quiz using php and jQueryhow do i make automatically changing quiz in HTML (jquery maybe?)Is there an “exists” function for jQuery?Create GUID / UUID in JavaScript?Add table row in jQueryHow do I check if an element is hidden in jQuery?Setting “checked” for a checkbox with jQuery?Creating a div element in jQueryHow to check whether a checkbox is checked in jQuery?How to decide when to use Node.js?jQuery scroll to element“Thinking in AngularJS” if I have a jQuery background?













4















Does anyone have an example of a quiz made with jQuery, without server-side processing of the results? After answering the questions, the result appears instantly. :)










share|improve this question















closed as off-topic by Shree, Makyen, dur, Dmitry, tripleee Mar 11 at 7:41


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – Shree, Makyen, dur, Dmitry, tripleee
If this question can be reworded to fit the rules in the help center, please edit the question.











  • 2





    I imagine it'd be a lot easier to get the answers right if the answer is included client-side. All the user would have to do is View Source.

    – Michael Todd
    Dec 16 '10 at 19:06






  • 1





    It's not an exam, just a small quiz with no challenge as objective.

    – SAC
    Dec 16 '10 at 19:08











  • sac, you can do it with div , hidden span hiddens approach right?

    – kobe
    Dec 16 '10 at 19:13















4















Does anyone have an example of a quiz made with jQuery, without server-side processing of the results? After answering the questions, the result appears instantly. :)










share|improve this question















closed as off-topic by Shree, Makyen, dur, Dmitry, tripleee Mar 11 at 7:41


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – Shree, Makyen, dur, Dmitry, tripleee
If this question can be reworded to fit the rules in the help center, please edit the question.











  • 2





    I imagine it'd be a lot easier to get the answers right if the answer is included client-side. All the user would have to do is View Source.

    – Michael Todd
    Dec 16 '10 at 19:06






  • 1





    It's not an exam, just a small quiz with no challenge as objective.

    – SAC
    Dec 16 '10 at 19:08











  • sac, you can do it with div , hidden span hiddens approach right?

    – kobe
    Dec 16 '10 at 19:13













4












4








4


9






Does anyone have an example of a quiz made with jQuery, without server-side processing of the results? After answering the questions, the result appears instantly. :)










share|improve this question
















Does anyone have an example of a quiz made with jQuery, without server-side processing of the results? After answering the questions, the result appears instantly. :)







javascript jquery






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Apr 30 '12 at 8:30









Eimantas

43.2k14117156




43.2k14117156










asked Dec 16 '10 at 19:01









SACSAC

24112




24112




closed as off-topic by Shree, Makyen, dur, Dmitry, tripleee Mar 11 at 7:41


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – Shree, Makyen, dur, Dmitry, tripleee
If this question can be reworded to fit the rules in the help center, please edit the question.







closed as off-topic by Shree, Makyen, dur, Dmitry, tripleee Mar 11 at 7:41


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – Shree, Makyen, dur, Dmitry, tripleee
If this question can be reworded to fit the rules in the help center, please edit the question.







  • 2





    I imagine it'd be a lot easier to get the answers right if the answer is included client-side. All the user would have to do is View Source.

    – Michael Todd
    Dec 16 '10 at 19:06






  • 1





    It's not an exam, just a small quiz with no challenge as objective.

    – SAC
    Dec 16 '10 at 19:08











  • sac, you can do it with div , hidden span hiddens approach right?

    – kobe
    Dec 16 '10 at 19:13












  • 2





    I imagine it'd be a lot easier to get the answers right if the answer is included client-side. All the user would have to do is View Source.

    – Michael Todd
    Dec 16 '10 at 19:06






  • 1





    It's not an exam, just a small quiz with no challenge as objective.

    – SAC
    Dec 16 '10 at 19:08











  • sac, you can do it with div , hidden span hiddens approach right?

    – kobe
    Dec 16 '10 at 19:13







2




2





I imagine it'd be a lot easier to get the answers right if the answer is included client-side. All the user would have to do is View Source.

– Michael Todd
Dec 16 '10 at 19:06





I imagine it'd be a lot easier to get the answers right if the answer is included client-side. All the user would have to do is View Source.

– Michael Todd
Dec 16 '10 at 19:06




1




1





It's not an exam, just a small quiz with no challenge as objective.

– SAC
Dec 16 '10 at 19:08





It's not an exam, just a small quiz with no challenge as objective.

– SAC
Dec 16 '10 at 19:08













sac, you can do it with div , hidden span hiddens approach right?

– kobe
Dec 16 '10 at 19:13





sac, you can do it with div , hidden span hiddens approach right?

– kobe
Dec 16 '10 at 19:13












4 Answers
4






active

oldest

votes


















2














Check this link for creating Jquery quiz using Google Docs. Self calculation of scores which instantly displays the result to users. Bit animated also.






share|improve this answer






























    2

















     $(document).ready(function()
    $("button").click(function()
    $("p").hide();
    );
    );

    $(document).ready(function()
    var a = $(".question");
    a.each(function(index)
    var flip = $(this).find(".flip");
    var panel = $(this).find(".panel");
    flip.click(function()
    panel.slideDown("slow");
    );
    );
    );

     
    div.panel,div.flip

    margin:0px;
    padding:5px;
    text-align:center;
    background:#e5eecc;
    border:solid 1px #c3c3c3;
    width:140px;


    div.panel

    display:none;

    div.question

    float:left;

    div.questions

    height: 80px;

    Here's an example makes it reasonably easy to add more questions once the initial javascript is in:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

    <head>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>


    <title>Javascript sample</title>
    </head>

    <body>

    <p>1) How many bits are in a byte?</p>
    <div class="questions">

    <div class="question">
    <div class="panel">Wrong</div>
    <div class="flip">7</div>
    </div>

    <div class="question">
    <div class="panel">Right</div>
    <div class="flip">8</div>
    </div>

    </div>

    </body>
    </html>








    share|improve this answer

























    • The one big problem here is that the answers are very easy to spot. If they were encrypted, or loaded from an external file somehow...

      – fiacobelli
      May 21 '14 at 12:51


















    1














    This is kind of what @gov was talking about but basically I would just capture the submit of the form:



    <form id="myform" onsubmit="return mySubmitHandler()">


    Then have a function to handle the submission:



    function mySubmitHandler()

    // the following are just examples of what you could do
    var q1val = jQuery('#q1').val();
    var q2val = jQuery('#q2').val();
    if(q1val + q2val > 5)
    jQuery('#success').show();
    else
    jQuery('#fail').show();
    // end example
    return false; // this keeps the form from doing a postback






    share|improve this answer






























      0

















       $(document).ready(function()

      var items = [
      ['male'],
      ['bus','bike'],
      ['painting','cricket'],
      ['hocky'],
      ['female'],
      ['bus','bike','car'],
      ['painting','sketches','pool'],
      ['cricket']
      ];
      var totalQuestion = items.length;
      var correctAns = -1;
      var i = 0;
      var j = 0;
      $('.checkBtn').on('click',function()

      $('.block').each(function()

      $(this).children('input').each(function()

      if($(this).is(':checked'))

      if(items[i][j] == $(this).val())
      $(this).parent().removeClass('incorrect');
      $(this).parent().addClass('correct');

      if(j < items[i].length - 1)
      j++;

      else
      $(this).parent().removeClass('correct');
      $(this).parent().addClass('incorrect');
      return false;

      else
      if(items[i][j] == $(this).val())
      $(this).parent().removeClass('correct');
      $(this).parent().addClass('incorrect');


      );
      i++;
      j=0;

      );

      $('.answer').html($('.correct').length + " / " + totalQuestion);
      );
      );

       .block
      padding:10px 15px;
      margin-bottom:15px;
      border:2px solid #dadada;
      border-radius:5px;

      .correct
      border:2px solid green;

      .incorrect
      border:2px solid red;

      input
      padding:10px;
      border:1px solid #dadada;

      span
      padding:2px 10px;
      display:inline-block;


       
      <!DOCTYPE html>
      <html>
      <title>HTML Tutorial</title>
      <link rel="stylesheet" type="text/css" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
      <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" ></script>


      <body>

      <div class="container">
      <br/>
      <h4 class="answer"></h4>
      <div id="que1" class="block">
      <h2>Gender?</h2>
      <input type="radio" name="gender" value="male"><span>male</span> <br>
      <input type="radio" name="gender" value="female"><span>female</span>
      </div>

      <div id="que2" class="block">
      <h2>Vehicle?</h2>
      <input type="checkbox" value="bus"><span>bus</span> <br>
      <input type="checkbox" value="bike"><span>bike</span> <br>
      <input type="checkbox" value="car"><span>car</span>
      </div>

      <div id="que3" class="block">
      <h2>Hobby?</h2>
      <input type="checkbox" value="painting"><span>painting</span> <br>
      <input type="checkbox" value="sketches"><span>sketches</span> <br>
      <input type="checkbox" value="pool"><span>pool</span> <br>
      <input type="checkbox" value="cricket"><span>cricket</span>
      </div>

      <div id="que5" class="block">
      <h2>National Game?</h2>
      <input type="radio" name="game" value="cricket"><span>cricket</span> <br>
      <input type="radio" name="game" value="hocky"><span>hocky</span>
      </div>

      <div id="que6" class="block">
      <h2>Gender?</h2>
      <input type="radio" name="gender2" value="male"><span>male</span> <br>
      <input type="radio" name="gender2" value="female"><span>female</span>
      </div>

      <div id="que7" class="block">
      <h2>Vehicle?</h2>
      <input type="checkbox" value="bus"><span>bus</span> <br>
      <input type="checkbox" value="bike"><span>bike</span> <br>
      <input type="checkbox" value="car"><span>car</span>
      </div>

      <div id="que8" class="block">
      <h2>Hobby?</h2>
      <input type="checkbox" value="painting"><span>painting</span> <br>
      <input type="checkbox" value="sketches"><span>sketches</span> <br>
      <input type="checkbox" value="pool"><span>pool</span>
      </div>

      <div id="que9" class="block">
      <h2>National Game?</h2>
      <input type="radio" name="game2" value="cricket"><span>cricket</span> <br>
      <input type="radio" name="game2" value="hocky"><span>hocky</span>
      </div>


      <br/>
      <a href="javascript:void(0)" class="checkBtn btn btn-primary">Submit</a>

      </div>
      </body>

      </html>








      share|improve this answer































        4 Answers
        4






        active

        oldest

        votes








        4 Answers
        4






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        2














        Check this link for creating Jquery quiz using Google Docs. Self calculation of scores which instantly displays the result to users. Bit animated also.






        share|improve this answer



























          2














          Check this link for creating Jquery quiz using Google Docs. Self calculation of scores which instantly displays the result to users. Bit animated also.






          share|improve this answer

























            2












            2








            2







            Check this link for creating Jquery quiz using Google Docs. Self calculation of scores which instantly displays the result to users. Bit animated also.






            share|improve this answer













            Check this link for creating Jquery quiz using Google Docs. Self calculation of scores which instantly displays the result to users. Bit animated also.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Jun 10 '13 at 18:09









            HariHari

            211




            211























                2

















                 $(document).ready(function()
                $("button").click(function()
                $("p").hide();
                );
                );

                $(document).ready(function()
                var a = $(".question");
                a.each(function(index)
                var flip = $(this).find(".flip");
                var panel = $(this).find(".panel");
                flip.click(function()
                panel.slideDown("slow");
                );
                );
                );

                 
                div.panel,div.flip

                margin:0px;
                padding:5px;
                text-align:center;
                background:#e5eecc;
                border:solid 1px #c3c3c3;
                width:140px;


                div.panel

                display:none;

                div.question

                float:left;

                div.questions

                height: 80px;

                Here's an example makes it reasonably easy to add more questions once the initial javascript is in:

                <?xml version="1.0" encoding="UTF-8"?>
                <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
                <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

                <head>
                <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>


                <title>Javascript sample</title>
                </head>

                <body>

                <p>1) How many bits are in a byte?</p>
                <div class="questions">

                <div class="question">
                <div class="panel">Wrong</div>
                <div class="flip">7</div>
                </div>

                <div class="question">
                <div class="panel">Right</div>
                <div class="flip">8</div>
                </div>

                </div>

                </body>
                </html>








                share|improve this answer

























                • The one big problem here is that the answers are very easy to spot. If they were encrypted, or loaded from an external file somehow...

                  – fiacobelli
                  May 21 '14 at 12:51















                2

















                 $(document).ready(function()
                $("button").click(function()
                $("p").hide();
                );
                );

                $(document).ready(function()
                var a = $(".question");
                a.each(function(index)
                var flip = $(this).find(".flip");
                var panel = $(this).find(".panel");
                flip.click(function()
                panel.slideDown("slow");
                );
                );
                );

                 
                div.panel,div.flip

                margin:0px;
                padding:5px;
                text-align:center;
                background:#e5eecc;
                border:solid 1px #c3c3c3;
                width:140px;


                div.panel

                display:none;

                div.question

                float:left;

                div.questions

                height: 80px;

                Here's an example makes it reasonably easy to add more questions once the initial javascript is in:

                <?xml version="1.0" encoding="UTF-8"?>
                <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
                <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

                <head>
                <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>


                <title>Javascript sample</title>
                </head>

                <body>

                <p>1) How many bits are in a byte?</p>
                <div class="questions">

                <div class="question">
                <div class="panel">Wrong</div>
                <div class="flip">7</div>
                </div>

                <div class="question">
                <div class="panel">Right</div>
                <div class="flip">8</div>
                </div>

                </div>

                </body>
                </html>








                share|improve this answer

























                • The one big problem here is that the answers are very easy to spot. If they were encrypted, or loaded from an external file somehow...

                  – fiacobelli
                  May 21 '14 at 12:51













                2












                2








                2










                 $(document).ready(function()
                $("button").click(function()
                $("p").hide();
                );
                );

                $(document).ready(function()
                var a = $(".question");
                a.each(function(index)
                var flip = $(this).find(".flip");
                var panel = $(this).find(".panel");
                flip.click(function()
                panel.slideDown("slow");
                );
                );
                );

                 
                div.panel,div.flip

                margin:0px;
                padding:5px;
                text-align:center;
                background:#e5eecc;
                border:solid 1px #c3c3c3;
                width:140px;


                div.panel

                display:none;

                div.question

                float:left;

                div.questions

                height: 80px;

                Here's an example makes it reasonably easy to add more questions once the initial javascript is in:

                <?xml version="1.0" encoding="UTF-8"?>
                <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
                <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

                <head>
                <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>


                <title>Javascript sample</title>
                </head>

                <body>

                <p>1) How many bits are in a byte?</p>
                <div class="questions">

                <div class="question">
                <div class="panel">Wrong</div>
                <div class="flip">7</div>
                </div>

                <div class="question">
                <div class="panel">Right</div>
                <div class="flip">8</div>
                </div>

                </div>

                </body>
                </html>








                share|improve this answer


















                 $(document).ready(function()
                $("button").click(function()
                $("p").hide();
                );
                );

                $(document).ready(function()
                var a = $(".question");
                a.each(function(index)
                var flip = $(this).find(".flip");
                var panel = $(this).find(".panel");
                flip.click(function()
                panel.slideDown("slow");
                );
                );
                );

                 
                div.panel,div.flip

                margin:0px;
                padding:5px;
                text-align:center;
                background:#e5eecc;
                border:solid 1px #c3c3c3;
                width:140px;


                div.panel

                display:none;

                div.question

                float:left;

                div.questions

                height: 80px;

                Here's an example makes it reasonably easy to add more questions once the initial javascript is in:

                <?xml version="1.0" encoding="UTF-8"?>
                <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
                <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

                <head>
                <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>


                <title>Javascript sample</title>
                </head>

                <body>

                <p>1) How many bits are in a byte?</p>
                <div class="questions">

                <div class="question">
                <div class="panel">Wrong</div>
                <div class="flip">7</div>
                </div>

                <div class="question">
                <div class="panel">Right</div>
                <div class="flip">8</div>
                </div>

                </div>

                </body>
                </html>








                 $(document).ready(function()
                $("button").click(function()
                $("p").hide();
                );
                );

                $(document).ready(function()
                var a = $(".question");
                a.each(function(index)
                var flip = $(this).find(".flip");
                var panel = $(this).find(".panel");
                flip.click(function()
                panel.slideDown("slow");
                );
                );
                );

                 
                div.panel,div.flip

                margin:0px;
                padding:5px;
                text-align:center;
                background:#e5eecc;
                border:solid 1px #c3c3c3;
                width:140px;


                div.panel

                display:none;

                div.question

                float:left;

                div.questions

                height: 80px;

                Here's an example makes it reasonably easy to add more questions once the initial javascript is in:

                <?xml version="1.0" encoding="UTF-8"?>
                <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
                <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

                <head>
                <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>


                <title>Javascript sample</title>
                </head>

                <body>

                <p>1) How many bits are in a byte?</p>
                <div class="questions">

                <div class="question">
                <div class="panel">Wrong</div>
                <div class="flip">7</div>
                </div>

                <div class="question">
                <div class="panel">Right</div>
                <div class="flip">8</div>
                </div>

                </div>

                </body>
                </html>





                 $(document).ready(function()
                $("button").click(function()
                $("p").hide();
                );
                );

                $(document).ready(function()
                var a = $(".question");
                a.each(function(index)
                var flip = $(this).find(".flip");
                var panel = $(this).find(".panel");
                flip.click(function()
                panel.slideDown("slow");
                );
                );
                );

                 
                div.panel,div.flip

                margin:0px;
                padding:5px;
                text-align:center;
                background:#e5eecc;
                border:solid 1px #c3c3c3;
                width:140px;


                div.panel

                display:none;

                div.question

                float:left;

                div.questions

                height: 80px;

                Here's an example makes it reasonably easy to add more questions once the initial javascript is in:

                <?xml version="1.0" encoding="UTF-8"?>
                <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
                <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

                <head>
                <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>


                <title>Javascript sample</title>
                </head>

                <body>

                <p>1) How many bits are in a byte?</p>
                <div class="questions">

                <div class="question">
                <div class="panel">Wrong</div>
                <div class="flip">7</div>
                </div>

                <div class="question">
                <div class="panel">Right</div>
                <div class="flip">8</div>
                </div>

                </div>

                </body>
                </html>






                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Mar 7 at 5:06









                v8-E

                6642918




                6642918










                answered Mar 21 '11 at 20:07









                Paul Vincent CravenPaul Vincent Craven

                1,50021518




                1,50021518












                • The one big problem here is that the answers are very easy to spot. If they were encrypted, or loaded from an external file somehow...

                  – fiacobelli
                  May 21 '14 at 12:51

















                • The one big problem here is that the answers are very easy to spot. If they were encrypted, or loaded from an external file somehow...

                  – fiacobelli
                  May 21 '14 at 12:51
















                The one big problem here is that the answers are very easy to spot. If they were encrypted, or loaded from an external file somehow...

                – fiacobelli
                May 21 '14 at 12:51





                The one big problem here is that the answers are very easy to spot. If they were encrypted, or loaded from an external file somehow...

                – fiacobelli
                May 21 '14 at 12:51











                1














                This is kind of what @gov was talking about but basically I would just capture the submit of the form:



                <form id="myform" onsubmit="return mySubmitHandler()">


                Then have a function to handle the submission:



                function mySubmitHandler()

                // the following are just examples of what you could do
                var q1val = jQuery('#q1').val();
                var q2val = jQuery('#q2').val();
                if(q1val + q2val > 5)
                jQuery('#success').show();
                else
                jQuery('#fail').show();
                // end example
                return false; // this keeps the form from doing a postback






                share|improve this answer



























                  1














                  This is kind of what @gov was talking about but basically I would just capture the submit of the form:



                  <form id="myform" onsubmit="return mySubmitHandler()">


                  Then have a function to handle the submission:



                  function mySubmitHandler()

                  // the following are just examples of what you could do
                  var q1val = jQuery('#q1').val();
                  var q2val = jQuery('#q2').val();
                  if(q1val + q2val > 5)
                  jQuery('#success').show();
                  else
                  jQuery('#fail').show();
                  // end example
                  return false; // this keeps the form from doing a postback






                  share|improve this answer

























                    1












                    1








                    1







                    This is kind of what @gov was talking about but basically I would just capture the submit of the form:



                    <form id="myform" onsubmit="return mySubmitHandler()">


                    Then have a function to handle the submission:



                    function mySubmitHandler()

                    // the following are just examples of what you could do
                    var q1val = jQuery('#q1').val();
                    var q2val = jQuery('#q2').val();
                    if(q1val + q2val > 5)
                    jQuery('#success').show();
                    else
                    jQuery('#fail').show();
                    // end example
                    return false; // this keeps the form from doing a postback






                    share|improve this answer













                    This is kind of what @gov was talking about but basically I would just capture the submit of the form:



                    <form id="myform" onsubmit="return mySubmitHandler()">


                    Then have a function to handle the submission:



                    function mySubmitHandler()

                    // the following are just examples of what you could do
                    var q1val = jQuery('#q1').val();
                    var q2val = jQuery('#q2').val();
                    if(q1val + q2val > 5)
                    jQuery('#success').show();
                    else
                    jQuery('#fail').show();
                    // end example
                    return false; // this keeps the form from doing a postback







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Dec 16 '10 at 19:26









                    KyleKyle

                    2,09773980




                    2,09773980





















                        0

















                         $(document).ready(function()

                        var items = [
                        ['male'],
                        ['bus','bike'],
                        ['painting','cricket'],
                        ['hocky'],
                        ['female'],
                        ['bus','bike','car'],
                        ['painting','sketches','pool'],
                        ['cricket']
                        ];
                        var totalQuestion = items.length;
                        var correctAns = -1;
                        var i = 0;
                        var j = 0;
                        $('.checkBtn').on('click',function()

                        $('.block').each(function()

                        $(this).children('input').each(function()

                        if($(this).is(':checked'))

                        if(items[i][j] == $(this).val())
                        $(this).parent().removeClass('incorrect');
                        $(this).parent().addClass('correct');

                        if(j < items[i].length - 1)
                        j++;

                        else
                        $(this).parent().removeClass('correct');
                        $(this).parent().addClass('incorrect');
                        return false;

                        else
                        if(items[i][j] == $(this).val())
                        $(this).parent().removeClass('correct');
                        $(this).parent().addClass('incorrect');


                        );
                        i++;
                        j=0;

                        );

                        $('.answer').html($('.correct').length + " / " + totalQuestion);
                        );
                        );

                         .block
                        padding:10px 15px;
                        margin-bottom:15px;
                        border:2px solid #dadada;
                        border-radius:5px;

                        .correct
                        border:2px solid green;

                        .incorrect
                        border:2px solid red;

                        input
                        padding:10px;
                        border:1px solid #dadada;

                        span
                        padding:2px 10px;
                        display:inline-block;


                         
                        <!DOCTYPE html>
                        <html>
                        <title>HTML Tutorial</title>
                        <link rel="stylesheet" type="text/css" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
                        <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" ></script>


                        <body>

                        <div class="container">
                        <br/>
                        <h4 class="answer"></h4>
                        <div id="que1" class="block">
                        <h2>Gender?</h2>
                        <input type="radio" name="gender" value="male"><span>male</span> <br>
                        <input type="radio" name="gender" value="female"><span>female</span>
                        </div>

                        <div id="que2" class="block">
                        <h2>Vehicle?</h2>
                        <input type="checkbox" value="bus"><span>bus</span> <br>
                        <input type="checkbox" value="bike"><span>bike</span> <br>
                        <input type="checkbox" value="car"><span>car</span>
                        </div>

                        <div id="que3" class="block">
                        <h2>Hobby?</h2>
                        <input type="checkbox" value="painting"><span>painting</span> <br>
                        <input type="checkbox" value="sketches"><span>sketches</span> <br>
                        <input type="checkbox" value="pool"><span>pool</span> <br>
                        <input type="checkbox" value="cricket"><span>cricket</span>
                        </div>

                        <div id="que5" class="block">
                        <h2>National Game?</h2>
                        <input type="radio" name="game" value="cricket"><span>cricket</span> <br>
                        <input type="radio" name="game" value="hocky"><span>hocky</span>
                        </div>

                        <div id="que6" class="block">
                        <h2>Gender?</h2>
                        <input type="radio" name="gender2" value="male"><span>male</span> <br>
                        <input type="radio" name="gender2" value="female"><span>female</span>
                        </div>

                        <div id="que7" class="block">
                        <h2>Vehicle?</h2>
                        <input type="checkbox" value="bus"><span>bus</span> <br>
                        <input type="checkbox" value="bike"><span>bike</span> <br>
                        <input type="checkbox" value="car"><span>car</span>
                        </div>

                        <div id="que8" class="block">
                        <h2>Hobby?</h2>
                        <input type="checkbox" value="painting"><span>painting</span> <br>
                        <input type="checkbox" value="sketches"><span>sketches</span> <br>
                        <input type="checkbox" value="pool"><span>pool</span>
                        </div>

                        <div id="que9" class="block">
                        <h2>National Game?</h2>
                        <input type="radio" name="game2" value="cricket"><span>cricket</span> <br>
                        <input type="radio" name="game2" value="hocky"><span>hocky</span>
                        </div>


                        <br/>
                        <a href="javascript:void(0)" class="checkBtn btn btn-primary">Submit</a>

                        </div>
                        </body>

                        </html>








                        share|improve this answer





























                          0

















                           $(document).ready(function()

                          var items = [
                          ['male'],
                          ['bus','bike'],
                          ['painting','cricket'],
                          ['hocky'],
                          ['female'],
                          ['bus','bike','car'],
                          ['painting','sketches','pool'],
                          ['cricket']
                          ];
                          var totalQuestion = items.length;
                          var correctAns = -1;
                          var i = 0;
                          var j = 0;
                          $('.checkBtn').on('click',function()

                          $('.block').each(function()

                          $(this).children('input').each(function()

                          if($(this).is(':checked'))

                          if(items[i][j] == $(this).val())
                          $(this).parent().removeClass('incorrect');
                          $(this).parent().addClass('correct');

                          if(j < items[i].length - 1)
                          j++;

                          else
                          $(this).parent().removeClass('correct');
                          $(this).parent().addClass('incorrect');
                          return false;

                          else
                          if(items[i][j] == $(this).val())
                          $(this).parent().removeClass('correct');
                          $(this).parent().addClass('incorrect');


                          );
                          i++;
                          j=0;

                          );

                          $('.answer').html($('.correct').length + " / " + totalQuestion);
                          );
                          );

                           .block
                          padding:10px 15px;
                          margin-bottom:15px;
                          border:2px solid #dadada;
                          border-radius:5px;

                          .correct
                          border:2px solid green;

                          .incorrect
                          border:2px solid red;

                          input
                          padding:10px;
                          border:1px solid #dadada;

                          span
                          padding:2px 10px;
                          display:inline-block;


                           
                          <!DOCTYPE html>
                          <html>
                          <title>HTML Tutorial</title>
                          <link rel="stylesheet" type="text/css" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
                          <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" ></script>


                          <body>

                          <div class="container">
                          <br/>
                          <h4 class="answer"></h4>
                          <div id="que1" class="block">
                          <h2>Gender?</h2>
                          <input type="radio" name="gender" value="male"><span>male</span> <br>
                          <input type="radio" name="gender" value="female"><span>female</span>
                          </div>

                          <div id="que2" class="block">
                          <h2>Vehicle?</h2>
                          <input type="checkbox" value="bus"><span>bus</span> <br>
                          <input type="checkbox" value="bike"><span>bike</span> <br>
                          <input type="checkbox" value="car"><span>car</span>
                          </div>

                          <div id="que3" class="block">
                          <h2>Hobby?</h2>
                          <input type="checkbox" value="painting"><span>painting</span> <br>
                          <input type="checkbox" value="sketches"><span>sketches</span> <br>
                          <input type="checkbox" value="pool"><span>pool</span> <br>
                          <input type="checkbox" value="cricket"><span>cricket</span>
                          </div>

                          <div id="que5" class="block">
                          <h2>National Game?</h2>
                          <input type="radio" name="game" value="cricket"><span>cricket</span> <br>
                          <input type="radio" name="game" value="hocky"><span>hocky</span>
                          </div>

                          <div id="que6" class="block">
                          <h2>Gender?</h2>
                          <input type="radio" name="gender2" value="male"><span>male</span> <br>
                          <input type="radio" name="gender2" value="female"><span>female</span>
                          </div>

                          <div id="que7" class="block">
                          <h2>Vehicle?</h2>
                          <input type="checkbox" value="bus"><span>bus</span> <br>
                          <input type="checkbox" value="bike"><span>bike</span> <br>
                          <input type="checkbox" value="car"><span>car</span>
                          </div>

                          <div id="que8" class="block">
                          <h2>Hobby?</h2>
                          <input type="checkbox" value="painting"><span>painting</span> <br>
                          <input type="checkbox" value="sketches"><span>sketches</span> <br>
                          <input type="checkbox" value="pool"><span>pool</span>
                          </div>

                          <div id="que9" class="block">
                          <h2>National Game?</h2>
                          <input type="radio" name="game2" value="cricket"><span>cricket</span> <br>
                          <input type="radio" name="game2" value="hocky"><span>hocky</span>
                          </div>


                          <br/>
                          <a href="javascript:void(0)" class="checkBtn btn btn-primary">Submit</a>

                          </div>
                          </body>

                          </html>








                          share|improve this answer



























                            0












                            0








                            0










                             $(document).ready(function()

                            var items = [
                            ['male'],
                            ['bus','bike'],
                            ['painting','cricket'],
                            ['hocky'],
                            ['female'],
                            ['bus','bike','car'],
                            ['painting','sketches','pool'],
                            ['cricket']
                            ];
                            var totalQuestion = items.length;
                            var correctAns = -1;
                            var i = 0;
                            var j = 0;
                            $('.checkBtn').on('click',function()

                            $('.block').each(function()

                            $(this).children('input').each(function()

                            if($(this).is(':checked'))

                            if(items[i][j] == $(this).val())
                            $(this).parent().removeClass('incorrect');
                            $(this).parent().addClass('correct');

                            if(j < items[i].length - 1)
                            j++;

                            else
                            $(this).parent().removeClass('correct');
                            $(this).parent().addClass('incorrect');
                            return false;

                            else
                            if(items[i][j] == $(this).val())
                            $(this).parent().removeClass('correct');
                            $(this).parent().addClass('incorrect');


                            );
                            i++;
                            j=0;

                            );

                            $('.answer').html($('.correct').length + " / " + totalQuestion);
                            );
                            );

                             .block
                            padding:10px 15px;
                            margin-bottom:15px;
                            border:2px solid #dadada;
                            border-radius:5px;

                            .correct
                            border:2px solid green;

                            .incorrect
                            border:2px solid red;

                            input
                            padding:10px;
                            border:1px solid #dadada;

                            span
                            padding:2px 10px;
                            display:inline-block;


                             
                            <!DOCTYPE html>
                            <html>
                            <title>HTML Tutorial</title>
                            <link rel="stylesheet" type="text/css" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
                            <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" ></script>


                            <body>

                            <div class="container">
                            <br/>
                            <h4 class="answer"></h4>
                            <div id="que1" class="block">
                            <h2>Gender?</h2>
                            <input type="radio" name="gender" value="male"><span>male</span> <br>
                            <input type="radio" name="gender" value="female"><span>female</span>
                            </div>

                            <div id="que2" class="block">
                            <h2>Vehicle?</h2>
                            <input type="checkbox" value="bus"><span>bus</span> <br>
                            <input type="checkbox" value="bike"><span>bike</span> <br>
                            <input type="checkbox" value="car"><span>car</span>
                            </div>

                            <div id="que3" class="block">
                            <h2>Hobby?</h2>
                            <input type="checkbox" value="painting"><span>painting</span> <br>
                            <input type="checkbox" value="sketches"><span>sketches</span> <br>
                            <input type="checkbox" value="pool"><span>pool</span> <br>
                            <input type="checkbox" value="cricket"><span>cricket</span>
                            </div>

                            <div id="que5" class="block">
                            <h2>National Game?</h2>
                            <input type="radio" name="game" value="cricket"><span>cricket</span> <br>
                            <input type="radio" name="game" value="hocky"><span>hocky</span>
                            </div>

                            <div id="que6" class="block">
                            <h2>Gender?</h2>
                            <input type="radio" name="gender2" value="male"><span>male</span> <br>
                            <input type="radio" name="gender2" value="female"><span>female</span>
                            </div>

                            <div id="que7" class="block">
                            <h2>Vehicle?</h2>
                            <input type="checkbox" value="bus"><span>bus</span> <br>
                            <input type="checkbox" value="bike"><span>bike</span> <br>
                            <input type="checkbox" value="car"><span>car</span>
                            </div>

                            <div id="que8" class="block">
                            <h2>Hobby?</h2>
                            <input type="checkbox" value="painting"><span>painting</span> <br>
                            <input type="checkbox" value="sketches"><span>sketches</span> <br>
                            <input type="checkbox" value="pool"><span>pool</span>
                            </div>

                            <div id="que9" class="block">
                            <h2>National Game?</h2>
                            <input type="radio" name="game2" value="cricket"><span>cricket</span> <br>
                            <input type="radio" name="game2" value="hocky"><span>hocky</span>
                            </div>


                            <br/>
                            <a href="javascript:void(0)" class="checkBtn btn btn-primary">Submit</a>

                            </div>
                            </body>

                            </html>








                            share|improve this answer


















                             $(document).ready(function()

                            var items = [
                            ['male'],
                            ['bus','bike'],
                            ['painting','cricket'],
                            ['hocky'],
                            ['female'],
                            ['bus','bike','car'],
                            ['painting','sketches','pool'],
                            ['cricket']
                            ];
                            var totalQuestion = items.length;
                            var correctAns = -1;
                            var i = 0;
                            var j = 0;
                            $('.checkBtn').on('click',function()

                            $('.block').each(function()

                            $(this).children('input').each(function()

                            if($(this).is(':checked'))

                            if(items[i][j] == $(this).val())
                            $(this).parent().removeClass('incorrect');
                            $(this).parent().addClass('correct');

                            if(j < items[i].length - 1)
                            j++;

                            else
                            $(this).parent().removeClass('correct');
                            $(this).parent().addClass('incorrect');
                            return false;

                            else
                            if(items[i][j] == $(this).val())
                            $(this).parent().removeClass('correct');
                            $(this).parent().addClass('incorrect');


                            );
                            i++;
                            j=0;

                            );

                            $('.answer').html($('.correct').length + " / " + totalQuestion);
                            );
                            );

                             .block
                            padding:10px 15px;
                            margin-bottom:15px;
                            border:2px solid #dadada;
                            border-radius:5px;

                            .correct
                            border:2px solid green;

                            .incorrect
                            border:2px solid red;

                            input
                            padding:10px;
                            border:1px solid #dadada;

                            span
                            padding:2px 10px;
                            display:inline-block;


                             
                            <!DOCTYPE html>
                            <html>
                            <title>HTML Tutorial</title>
                            <link rel="stylesheet" type="text/css" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
                            <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" ></script>


                            <body>

                            <div class="container">
                            <br/>
                            <h4 class="answer"></h4>
                            <div id="que1" class="block">
                            <h2>Gender?</h2>
                            <input type="radio" name="gender" value="male"><span>male</span> <br>
                            <input type="radio" name="gender" value="female"><span>female</span>
                            </div>

                            <div id="que2" class="block">
                            <h2>Vehicle?</h2>
                            <input type="checkbox" value="bus"><span>bus</span> <br>
                            <input type="checkbox" value="bike"><span>bike</span> <br>
                            <input type="checkbox" value="car"><span>car</span>
                            </div>

                            <div id="que3" class="block">
                            <h2>Hobby?</h2>
                            <input type="checkbox" value="painting"><span>painting</span> <br>
                            <input type="checkbox" value="sketches"><span>sketches</span> <br>
                            <input type="checkbox" value="pool"><span>pool</span> <br>
                            <input type="checkbox" value="cricket"><span>cricket</span>
                            </div>

                            <div id="que5" class="block">
                            <h2>National Game?</h2>
                            <input type="radio" name="game" value="cricket"><span>cricket</span> <br>
                            <input type="radio" name="game" value="hocky"><span>hocky</span>
                            </div>

                            <div id="que6" class="block">
                            <h2>Gender?</h2>
                            <input type="radio" name="gender2" value="male"><span>male</span> <br>
                            <input type="radio" name="gender2" value="female"><span>female</span>
                            </div>

                            <div id="que7" class="block">
                            <h2>Vehicle?</h2>
                            <input type="checkbox" value="bus"><span>bus</span> <br>
                            <input type="checkbox" value="bike"><span>bike</span> <br>
                            <input type="checkbox" value="car"><span>car</span>
                            </div>

                            <div id="que8" class="block">
                            <h2>Hobby?</h2>
                            <input type="checkbox" value="painting"><span>painting</span> <br>
                            <input type="checkbox" value="sketches"><span>sketches</span> <br>
                            <input type="checkbox" value="pool"><span>pool</span>
                            </div>

                            <div id="que9" class="block">
                            <h2>National Game?</h2>
                            <input type="radio" name="game2" value="cricket"><span>cricket</span> <br>
                            <input type="radio" name="game2" value="hocky"><span>hocky</span>
                            </div>


                            <br/>
                            <a href="javascript:void(0)" class="checkBtn btn btn-primary">Submit</a>

                            </div>
                            </body>

                            </html>








                             $(document).ready(function()

                            var items = [
                            ['male'],
                            ['bus','bike'],
                            ['painting','cricket'],
                            ['hocky'],
                            ['female'],
                            ['bus','bike','car'],
                            ['painting','sketches','pool'],
                            ['cricket']
                            ];
                            var totalQuestion = items.length;
                            var correctAns = -1;
                            var i = 0;
                            var j = 0;
                            $('.checkBtn').on('click',function()

                            $('.block').each(function()

                            $(this).children('input').each(function()

                            if($(this).is(':checked'))

                            if(items[i][j] == $(this).val())
                            $(this).parent().removeClass('incorrect');
                            $(this).parent().addClass('correct');

                            if(j < items[i].length - 1)
                            j++;

                            else
                            $(this).parent().removeClass('correct');
                            $(this).parent().addClass('incorrect');
                            return false;

                            else
                            if(items[i][j] == $(this).val())
                            $(this).parent().removeClass('correct');
                            $(this).parent().addClass('incorrect');


                            );
                            i++;
                            j=0;

                            );

                            $('.answer').html($('.correct').length + " / " + totalQuestion);
                            );
                            );

                             .block
                            padding:10px 15px;
                            margin-bottom:15px;
                            border:2px solid #dadada;
                            border-radius:5px;

                            .correct
                            border:2px solid green;

                            .incorrect
                            border:2px solid red;

                            input
                            padding:10px;
                            border:1px solid #dadada;

                            span
                            padding:2px 10px;
                            display:inline-block;


                             
                            <!DOCTYPE html>
                            <html>
                            <title>HTML Tutorial</title>
                            <link rel="stylesheet" type="text/css" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
                            <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" ></script>


                            <body>

                            <div class="container">
                            <br/>
                            <h4 class="answer"></h4>
                            <div id="que1" class="block">
                            <h2>Gender?</h2>
                            <input type="radio" name="gender" value="male"><span>male</span> <br>
                            <input type="radio" name="gender" value="female"><span>female</span>
                            </div>

                            <div id="que2" class="block">
                            <h2>Vehicle?</h2>
                            <input type="checkbox" value="bus"><span>bus</span> <br>
                            <input type="checkbox" value="bike"><span>bike</span> <br>
                            <input type="checkbox" value="car"><span>car</span>
                            </div>

                            <div id="que3" class="block">
                            <h2>Hobby?</h2>
                            <input type="checkbox" value="painting"><span>painting</span> <br>
                            <input type="checkbox" value="sketches"><span>sketches</span> <br>
                            <input type="checkbox" value="pool"><span>pool</span> <br>
                            <input type="checkbox" value="cricket"><span>cricket</span>
                            </div>

                            <div id="que5" class="block">
                            <h2>National Game?</h2>
                            <input type="radio" name="game" value="cricket"><span>cricket</span> <br>
                            <input type="radio" name="game" value="hocky"><span>hocky</span>
                            </div>

                            <div id="que6" class="block">
                            <h2>Gender?</h2>
                            <input type="radio" name="gender2" value="male"><span>male</span> <br>
                            <input type="radio" name="gender2" value="female"><span>female</span>
                            </div>

                            <div id="que7" class="block">
                            <h2>Vehicle?</h2>
                            <input type="checkbox" value="bus"><span>bus</span> <br>
                            <input type="checkbox" value="bike"><span>bike</span> <br>
                            <input type="checkbox" value="car"><span>car</span>
                            </div>

                            <div id="que8" class="block">
                            <h2>Hobby?</h2>
                            <input type="checkbox" value="painting"><span>painting</span> <br>
                            <input type="checkbox" value="sketches"><span>sketches</span> <br>
                            <input type="checkbox" value="pool"><span>pool</span>
                            </div>

                            <div id="que9" class="block">
                            <h2>National Game?</h2>
                            <input type="radio" name="game2" value="cricket"><span>cricket</span> <br>
                            <input type="radio" name="game2" value="hocky"><span>hocky</span>
                            </div>


                            <br/>
                            <a href="javascript:void(0)" class="checkBtn btn btn-primary">Submit</a>

                            </div>
                            </body>

                            </html>





                             $(document).ready(function()

                            var items = [
                            ['male'],
                            ['bus','bike'],
                            ['painting','cricket'],
                            ['hocky'],
                            ['female'],
                            ['bus','bike','car'],
                            ['painting','sketches','pool'],
                            ['cricket']
                            ];
                            var totalQuestion = items.length;
                            var correctAns = -1;
                            var i = 0;
                            var j = 0;
                            $('.checkBtn').on('click',function()

                            $('.block').each(function()

                            $(this).children('input').each(function()

                            if($(this).is(':checked'))

                            if(items[i][j] == $(this).val())
                            $(this).parent().removeClass('incorrect');
                            $(this).parent().addClass('correct');

                            if(j < items[i].length - 1)
                            j++;

                            else
                            $(this).parent().removeClass('correct');
                            $(this).parent().addClass('incorrect');
                            return false;

                            else
                            if(items[i][j] == $(this).val())
                            $(this).parent().removeClass('correct');
                            $(this).parent().addClass('incorrect');


                            );
                            i++;
                            j=0;

                            );

                            $('.answer').html($('.correct').length + " / " + totalQuestion);
                            );
                            );

                             .block
                            padding:10px 15px;
                            margin-bottom:15px;
                            border:2px solid #dadada;
                            border-radius:5px;

                            .correct
                            border:2px solid green;

                            .incorrect
                            border:2px solid red;

                            input
                            padding:10px;
                            border:1px solid #dadada;

                            span
                            padding:2px 10px;
                            display:inline-block;


                             
                            <!DOCTYPE html>
                            <html>
                            <title>HTML Tutorial</title>
                            <link rel="stylesheet" type="text/css" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
                            <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" ></script>


                            <body>

                            <div class="container">
                            <br/>
                            <h4 class="answer"></h4>
                            <div id="que1" class="block">
                            <h2>Gender?</h2>
                            <input type="radio" name="gender" value="male"><span>male</span> <br>
                            <input type="radio" name="gender" value="female"><span>female</span>
                            </div>

                            <div id="que2" class="block">
                            <h2>Vehicle?</h2>
                            <input type="checkbox" value="bus"><span>bus</span> <br>
                            <input type="checkbox" value="bike"><span>bike</span> <br>
                            <input type="checkbox" value="car"><span>car</span>
                            </div>

                            <div id="que3" class="block">
                            <h2>Hobby?</h2>
                            <input type="checkbox" value="painting"><span>painting</span> <br>
                            <input type="checkbox" value="sketches"><span>sketches</span> <br>
                            <input type="checkbox" value="pool"><span>pool</span> <br>
                            <input type="checkbox" value="cricket"><span>cricket</span>
                            </div>

                            <div id="que5" class="block">
                            <h2>National Game?</h2>
                            <input type="radio" name="game" value="cricket"><span>cricket</span> <br>
                            <input type="radio" name="game" value="hocky"><span>hocky</span>
                            </div>

                            <div id="que6" class="block">
                            <h2>Gender?</h2>
                            <input type="radio" name="gender2" value="male"><span>male</span> <br>
                            <input type="radio" name="gender2" value="female"><span>female</span>
                            </div>

                            <div id="que7" class="block">
                            <h2>Vehicle?</h2>
                            <input type="checkbox" value="bus"><span>bus</span> <br>
                            <input type="checkbox" value="bike"><span>bike</span> <br>
                            <input type="checkbox" value="car"><span>car</span>
                            </div>

                            <div id="que8" class="block">
                            <h2>Hobby?</h2>
                            <input type="checkbox" value="painting"><span>painting</span> <br>
                            <input type="checkbox" value="sketches"><span>sketches</span> <br>
                            <input type="checkbox" value="pool"><span>pool</span>
                            </div>

                            <div id="que9" class="block">
                            <h2>National Game?</h2>
                            <input type="radio" name="game2" value="cricket"><span>cricket</span> <br>
                            <input type="radio" name="game2" value="hocky"><span>hocky</span>
                            </div>


                            <br/>
                            <a href="javascript:void(0)" class="checkBtn btn btn-primary">Submit</a>

                            </div>
                            </body>

                            </html>






                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited Mar 7 at 5:00









                            v8-E

                            6642918




                            6642918










                            answered Mar 7 at 4:20









                            Vaibhav PanchalVaibhav Panchal

                            11




                            11













                                Popular posts from this blog

                                1928 у кіно

                                Захаров Федір Захарович

                                Ель Греко