Navigation

    Monaca & Onsen UI
    • Register
    • Login
    • Search
    • Tags
    • Users
    • Blog
    • Playground
    1. Home
    2. Antonio Andres
    A
    • Flag Profile
    • Profile
    • Following
    • Followers
    • Blocks
    • Topics
    • Posts
    • Best
    • Groups
    Save
    Saving

    Antonio Andres

    @Antonio Andres

    0
    Reputation
    1
    Posts
    402
    Profile views
    0
    Followers
    0
    Following
    Joined Last Online

    Antonio Andres Follow

    Posts made by Antonio Andres

    • Connect JavaScript quiz with Onsen UI

      I have a JavaScript quiz with radio buttons answers. I have the questions and anwers as an array as you can see.

      The point is that the Onsen UI style is not displaying - the buttons are “plain” buttons instead. I guess I just need to add a really simple codein the answers.push but I can’t figure out.

      Here is the part that I think needs the code:

         answers.push(
                `<label>
                  <input type="radio" name="question${questionNumber}" value="${letter}">
                  ${letter} :
                  ${currentQuestion.answers[letter]}
                </label>`
              );
      

      The array:

      var questionPool = [
          {
            question: "¿Por qué es importante la autoestima?",
            answers: {
              a: "Porque ayuda a moverse en el espacio físico.",
              b: "Porque fomenta la seguridad en uno mismo.",
              c: "Porque se diseña mejor la unidad didáctica."
            },
            correctAnswer: "b"
          },
          {
            question: "Los servicios higiénicos...",
            answers: {
              a: "No se deben separar por sexo.",
              b: "Deben estar limpios y desinfectados.",
              c: "Se diferencian sólo por edad."
            },
            correctAnswer: "b"
          }
      ];
      
      

      Just in case you want to see the complete codepen: https://codepen.io/anon/pen/WMpqKg

      posted in Onsen UI
      A
      Antonio Andres