+ 2

I want to print only selected values.How can I do that?

I want to make a form in which input type=checkbox and on submission, a page opens showing something based on selected options.l don't know how to do that. Can I do that using JavaScript or I need to learn php for that? This code gives an idea like what I want to do. https://code.sololearn.com/WF8Yq0RIRZ02/?ref=app

25th Apr 2020, 1:45 PM
Ankur Singh Oli
Ankur Singh Oli - avatar
5 odpowiedzi
+ 1
Ankur Singh Oli Just do like this var name = document.getElementsByName('skill'); var message = "You selected -" for(var i = 0; i < name.length; i++) { if(name[i].checked) message = message + " " + name[i].value }
25th Apr 2020, 2:05 PM
A͢J
A͢J - avatar
+ 3
AJ #Infinity Love Thanks it works. But if I use form tag then how can I do the same.
25th Apr 2020, 2:21 PM
Ankur Singh Oli
Ankur Singh Oli - avatar
+ 3
AJ #Infinity Love Thanks once again.
25th Apr 2020, 2:42 PM
Ankur Singh Oli
Ankur Singh Oli - avatar
+ 1
Ankur Singh Oli Same no need to change anything Because we are getting value using element name. So form tag doesn't matter.
25th Apr 2020, 2:33 PM
A͢J
A͢J - avatar