How do I get user input and interaction from submit button? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How do I get user input and interaction from submit button?

I have a simple code with a Math problem. Im trying to get the user to click on the correct answer and then click on submit. Im guessing I need an onSubmit syntax, but how do I verify the correct answer? Do I use an If/else statement inside the input syntax? What is 144+144=?<br> <input type="radio" name="" value="288" />288<br /> <input type="radio" name="" value="287" />287 <br /> <input type="submit" value="Submit"/>

29th Nov 2017, 10:57 PM
Howard Eugene Patrick Jr
Howard Eugene Patrick Jr - avatar
4 Answers
+ 5
use jquery .... is something like this: if (document.getElementById('isAnswerCorrectSelected').checked) { $("#CorrectAnswer").show(); } else { $("#WrongAnswer").show();
29th Nov 2017, 11:06 PM
Malkon F
Malkon F - avatar
+ 5
Wow, this number again! lol
29th Nov 2017, 11:15 PM
Malkon F
Malkon F - avatar
+ 1
lol yea. thank you. I was hoping learning HTML and JavaScript would be enough. Apparently, people keep telling me to learn Jquery though lol. I appreciate your answer.
29th Nov 2017, 11:24 PM
Howard Eugene Patrick Jr
Howard Eugene Patrick Jr - avatar
0
thank you. that's what I thought, onClick and submit. good answer.
30th Nov 2017, 3:06 AM
Howard Eugene Patrick Jr
Howard Eugene Patrick Jr - avatar