Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. How to check the answer in a quiz?

How to check the answer in a quiz?

Scheduled Pinned Locked Moved The Lounge
questiondockertutorial
8 Posts 8 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Tarun Rathore
    wrote on last edited by
    #1

    I have made a sortable list to rearrange the words to make a meaningful sentence. I am unable to figure out why the alert in checking the answer section is not working. This is not working: alert('success');

    $(document).ready(function () {
    var words = [];
    var i = 0;
    function showWords() {
    $('#container').append("

    ");
    for (var j = 0; j < words[i].question.length; j++) {
    $('#list').append("* " + words[i].question[j] + " " + "
    ");
    }

    $('#list').sortable({
        placeholder: 'back',
        axis: 'x',
        opacity: '0.7'
    });
    

    }
    showWords();

    $(document).on('click', '#btn', function () {
    var guess = $('.box').text();
    $('#list').empty();
    if (i < words.length); {
    var correct = words[i].answer;
    i++;
    showWords();
    }
    if (guess === correct) {
    alert('success');
    }
    });
    });

    Mike HankeyM abmvA W 3 Replies Last reply
    0
    • T Tarun Rathore

      I have made a sortable list to rearrange the words to make a meaningful sentence. I am unable to figure out why the alert in checking the answer section is not working. This is not working: alert('success');

      $(document).ready(function () {
      var words = [];
      var i = 0;
      function showWords() {
      $('#container').append("

      ");
      for (var j = 0; j < words[i].question.length; j++) {
      $('#list').append("* " + words[i].question[j] + " " + "
      ");
      }

      $('#list').sortable({
          placeholder: 'back',
          axis: 'x',
          opacity: '0.7'
      });
      

      }
      showWords();

      $(document).on('click', '#btn', function () {
      var guess = $('.box').text();
      $('#list').empty();
      if (i < words.length); {
      var correct = words[i].answer;
      i++;
      showWords();
      }
      if (guess === correct) {
      alert('success');
      }
      });
      });

      Mike HankeyM Offline
      Mike HankeyM Offline
      Mike Hankey
      wrote on last edited by
      #2

      Welcome, you've posted your question in the wrong area. Look above at the red text, there's a link that will take you to an area where you can ask your question.

      Give me coffee to change the things I can and wine to accept the things I cannot! JaxCoder.com

      L 1 Reply Last reply
      0
      • Mike HankeyM Mike Hankey

        Welcome, you've posted your question in the wrong area. Look above at the red text, there's a link that will take you to an area where you can ask your question.

        Give me coffee to change the things I can and wine to accept the things I cannot! JaxCoder.com

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        clearly his problem is storing (remembering?) words, not reading them.

        1 Reply Last reply
        0
        • T Tarun Rathore

          I have made a sortable list to rearrange the words to make a meaningful sentence. I am unable to figure out why the alert in checking the answer section is not working. This is not working: alert('success');

          $(document).ready(function () {
          var words = [];
          var i = 0;
          function showWords() {
          $('#container').append("

          ");
          for (var j = 0; j < words[i].question.length; j++) {
          $('#list').append("* " + words[i].question[j] + " " + "
          ");
          }

          $('#list').sortable({
              placeholder: 'back',
              axis: 'x',
              opacity: '0.7'
          });
          

          }
          showWords();

          $(document).on('click', '#btn', function () {
          var guess = $('.box').text();
          $('#list').empty();
          if (i < words.length); {
          var correct = words[i].answer;
          i++;
          showWords();
          }
          if (guess === correct) {
          alert('success');
          }
          });
          });

          abmvA Offline
          abmvA Offline
          abmv
          wrote on last edited by
          #4

          visit stackoverflow.com sign up for an account post question wait answer profit!!!

          Caveat Emptor. "Progress doesn't come from early risers – progress is made by lazy men looking for easier ways to do things." Lazarus Long

          We are in the beginning of a mass extinction. - Greta Thunberg

          P M 2 Replies Last reply
          0
          • abmvA abmv

            visit stackoverflow.com sign up for an account post question wait answer profit!!!

            Caveat Emptor. "Progress doesn't come from early risers – progress is made by lazy men looking for easier ways to do things." Lazarus Long

            P Offline
            P Offline
            Pete OHanlon
            wrote on last edited by
            #5

            abmv wrote:

            visit stackoverflow.com

            I can't believe you're recommending the competition here. If only there were somewhere on CP for people to ask questions.

            This space for rent

            B 1 Reply Last reply
            0
            • abmvA abmv

              visit stackoverflow.com sign up for an account post question wait answer profit!!!

              Caveat Emptor. "Progress doesn't come from early risers – progress is made by lazy men looking for easier ways to do things." Lazarus Long

              M Offline
              M Offline
              Marc Clifton
              wrote on last edited by
              #6

              Which Ferengi rule of acquisition is that? ;)

              Latest Article - A 4-Stack rPI Cluster with WiFi-Ethernet Bridging Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

              1 Reply Last reply
              0
              • T Tarun Rathore

                I have made a sortable list to rearrange the words to make a meaningful sentence. I am unable to figure out why the alert in checking the answer section is not working. This is not working: alert('success');

                $(document).ready(function () {
                var words = [];
                var i = 0;
                function showWords() {
                $('#container').append("

                ");
                for (var j = 0; j < words[i].question.length; j++) {
                $('#list').append("* " + words[i].question[j] + " " + "
                ");
                }

                $('#list').sortable({
                    placeholder: 'back',
                    axis: 'x',
                    opacity: '0.7'
                });
                

                }
                showWords();

                $(document).on('click', '#btn', function () {
                var guess = $('.box').text();
                $('#list').empty();
                if (i < words.length); {
                var correct = words[i].answer;
                i++;
                showWords();
                }
                if (guess === correct) {
                alert('success');
                }
                });
                });

                W Offline
                W Offline
                W Balboos GHB
                wrote on last edited by
                #7

                Since you already have the words, just arrange them yourself - it'll should be no problem at all, once you get rid of those "{" and "}" that are just confusing the issue.

                Ravings en masse^

                "The difference between genius and stupidity is that genius has its limits." - Albert Einstein

                "If you are searching for perfection in others, then you seek disappointment. If you are seek perfection in yourself, then you will find failure." - Balboos HaGadol Mar 2010

                1 Reply Last reply
                0
                • P Pete OHanlon

                  abmv wrote:

                  visit stackoverflow.com

                  I can't believe you're recommending the competition here. If only there were somewhere on CP for people to ask questions.

                  This space for rent

                  B Offline
                  B Offline
                  BillWoodruff
                  wrote on last edited by
                  #8

                  Pete O'Hanlon wrote:

                  If only there were somewhere on CP for people to ask questions.

                  If only good people with the best technical minds on CP, like Pete, and Marc, answered questions in somewhere on CP for people to ask questions :)

                  «Where is the Life we have lost in living? Where is the wisdom we have lost in knowledge? Where is the knowledge we have lost in information?» T. S. Elliot

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups