Skip to content

Instantly share code, notes, and snippets.

@Youngestdev
Created January 16, 2018 11:52
Show Gist options
  • Select an option

  • Save Youngestdev/7f579349280da3afa2eb7974b72b29e2 to your computer and use it in GitHub Desktop.

Select an option

Save Youngestdev/7f579349280da3afa2eb7974b72b29e2 to your computer and use it in GitHub Desktop.
User secrtion
Hi, how can i get the clicked option from these checkboxes in node ?
```html
<title>{{ title }}</title>
<h2>Welcome to the quiz</h2>
<p>This is a quiz about me. It has just 10 questions.</p>
<h6 id="test">To start the quiz, click the button below</h6>
<p class="paper-btn" title="Start" id="start">Start</button>
<div style="display: none" id="show">
<form action="/score" method="post" id="quiz">
<b>Instructions :</b>
<p>1. Do Not Refresh the page</p>
<p>2.Select only <b>1</b> box, selection of two or more will result in the loss of mark of the particular question.</p>
<h2> Questions </h2>
<ol>
<label for="question1">Question 1. </label>
<b>Who am i ?</b>
<ul id="q1">
<li>
<input type="checkbox" name="answer[1][]" />Abdul
<input type="checkbox" name="answer[1][]" />Tawa
<input type="checkbox" name="answer[1][]" />Safu
<input type="checkbox" name="answer[1][]" />Sule
</li>
</ul>
<label for="Question2"> Question 2.
<b>How old am i ?
<ul id="q2">
<li>
<input type="checkbox" name="answer[2][]" />10
<input type="checkbox" name="answer[2][]" />20
<input type="checkbox" name="answer[2][]" />15
<input type="checkbox" name="answer[2][]" />19
</li>
</ul>
</b>
</label>
<label for="Question3"> Question 3.
<b>How many sisters do i have ?
<ul id="q3">
<li>
<input type="checkbox" name="answer[3][]" />6
<input type="checkbox" name="answer[3][]" />8
<input type="checkbox" name="answer[3][]" />2
<input type="checkbox" name="answer[3][]" />3
</li>
</ul>
</b>
</label>
<label for="Question4"> Question 4.
<b>What's my hobby ?
<ul id="q4">
<li>
<input type="checkbox" name="answer[4][]" />Eating
<input type="checkbox" name="answer[4][]" />Programming
<input type="checkbox" name="answer[4][]" />Sleeping
<input type="checkbox" name="answer[4][]" />Writing
</li>
</ul>
</b>
</label>
<label for="Question5"> Question 5
<b>What's my favorite text editor ?
<ul id="q5">
<li>
<input type="checkbox" name="answer[5][]" />Visual Studio Code
<input type="checkbox" name="answer[5][]" />Sublime
<input type="checkbox" name="answer[5][]" />Wordpad
<input type="checkbox" name="answer[5][]" />Notepad
</li>
</ul>
</b>
</label>
<label for="Question6"> Question 6
<b>What is my favorite programming language ?
<ul id="q6">
<li>
<input type="checkbox" name="answer[6][]" />C++
<input type="checkbox" name="answer[6][]" />C#
<input type="checkbox" name="answer[6][]" />Php
<input type="checkbox" name="answer[6][]" />JavaScript
</li>
</ul>
</b>
</label>
<label for="Question7"> Question 7
<b>What was the first Unique programming language i learnt ?
<ul id="q7">
<li>
<input type="checkbox" name="answer[7][]" />Java
<input type="checkbox" name="answer[7][]" />C++
<input type="checkbox" name="answer[7][]" />Ruby
<input type="checkbox" name="answer[7][]" />Python
</li>
</ul>
</b>
</label>
<label for="Question8"> Question 8
<b>What is my favorite framework ?
<ul id="q8">
<li>
<input type="checkbox" name="answer[8][]" />ExpressJS
<input type="checkbox" name="answer[8][]" />None
<input type="checkbox" name="answer[8][]" />AdonisJs
<input type="checkbox" name="answer[8][]" />Hapi
</li>
</ul>
</b>
</label>
<label for="Question9"> Question 9
<b>I am a _______ guy .
<ul id="q9">
<li>
<input type="checkbox" name="answer[9][]" />Cool
<input type="checkbox" name="answer[9][]" />Gentle
<input type="checkbox" name="answer[9][]" />Stubborn
<input type="checkbox" name="answer[9][]" />Problematic
</li>
</ul>
</b>
</label>
<label for="Question10"> Question 10
<b>Rate my app over 10.
<ul id="q10">
<li>
<input type="checkbox" name="answer[10][]" />1
<input type="checkbox" name="answer[10][]" />5
<input type="checkbox" name="answer[10][]" />9
<input type="checkbox" name="answer[10][]" />10
</li>
</ul>
</b>
</label>
</ol>
<button type="submit">Submit</button>
</form>
</div>
<script src="/js/script.js"></script>
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment