10 Answers
New AnswerUse setValues() as the handler for the main form's submit event. <form onsubmit="setValues()">
It is quit simple target the input element of which you want to get the value By using 1. document.getElementById("id_name") 2. document.getElementsByClassName("class_name") The fetch the value using .value Final syntex 1. document.getElementById("id_name").value 2. document.getElementsByClassName("class_name").value Store it Into variables and use them
乂丹ⓨㄩک廾乂〖թг๏〗 if you see my code it's the same logic I used that you tell me but my code not give value on the console
All the attributes in The very first "div" in the "form" tag should be in the "form" tag and not the "div" tag, that should fix it.
Hey man!!! You have call your setvalues fxn with event onsubmit on a div !! I mean how can you submit a div!!🙄😵 I think it should be on form tag . actually you have set all attributes of form to that div.. just transfer all attributes to form it will work as u want.
Sololearn Inc.
535 Mission Street, Suite 1591Send us a message