+ 2

HTML/JS Do checkboxes return true/false? HELP

So I am trying to use checkboxes but I am not sure how it works. I want a user to select foods they don't like a submit a form. afterwards, I want to display the outcome using JS. I wrote some code but I don't know how to finish it up. How do I get it to work? How do I use the submit button? https://code.sololearn.com/WsM2dGQ3jp6P/?ref=app

5th Apr 2018, 9:03 AM
Kacper Orłowski
Kacper Orłowski - avatar
13 Respuestas
5th Apr 2018, 10:58 AM
Emma
+ 2
You are the master. Thank you 😊
5th Apr 2018, 11:14 AM
Kacper Orłowski
Kacper Orłowski - avatar
+ 2
Thanks Kacper ☺ Note, it might be more suitable to do the form submit code in PHP (or whatever server-side language you're using). Good luck! ☺
5th Apr 2018, 11:17 AM
Emma
+ 2
I will, but I have to learn it first. I am learning JS at the moment I experiment with it to understand it better 😊
5th Apr 2018, 11:19 AM
Kacper Orłowski
Kacper Orłowski - avatar
+ 1
Yes of course ☺ Best to learn one thing at a time.
5th Apr 2018, 11:20 AM
Emma
+ 1
Yup. If I do all at once I will get lost at some point. It happened last year and I have up. I came back stronger this time 😊
5th Apr 2018, 11:22 AM
Kacper Orłowski
Kacper Orłowski - avatar
+ 1
Xan How did you make the test submit button? I thought you only used a regular button instead of a submit button. But it doesn't work as it should on this code that I wrote now. https://code.sololearn.com/WYBXFd0WhqJ2/?ref=app
13th Apr 2018, 1:36 PM
Kacper Orłowski
Kacper Orłowski - avatar
+ 1
nevermind, I figured it out. All I had to do is remove the <button> out of the <form> tag. 😁
13th Apr 2018, 1:39 PM
Kacper Orłowski
Kacper Orłowski - avatar
+ 1
Kacper Orłowski Great you worked it out ☺
13th Apr 2018, 2:32 PM
Emma
+ 1
yeah. I have a good understanding of how coding works, but sometimes even the little things can be hard to spot 🤗
13th Apr 2018, 2:35 PM
Kacper Orłowski
Kacper Orłowski - avatar
+ 1
Definitely! Even a highly experienced programmer will sometimes miss the little things! Indeed, the hardest bugs to fix, are often little (in coding terms) and intermittent. That's why unit testing is so powerful, and code reviews. We sometimes can't see our own mistakes, as easily as we can see someone else's.
13th Apr 2018, 2:38 PM
Emma
+ 1
This is why I always ask the Sololearn community for help.
13th Apr 2018, 2:42 PM
Kacper Orłowski
Kacper Orłowski - avatar
+ 1
That's great ☺ When learning programming, I think it's about balancing seeking help to early (so not improving our own debugging / problem solving skills), versus seeking help too late.
13th Apr 2018, 2:44 PM
Emma