I want to validate the select method with submit type button. I have created a form and under that, I have created the select method and given some options. By submit type, the onClick
should validate my submit type with the options in the select method. How can I assign the value of option
to var t
based on select?
According to the select option my var t
should be changed.
If the value is volvo then it should print val11, similarly Saab= val14, opel= val82, Audi= val34
<select name="carlist" class="temp>
<option value="10">Volvo</option>
<option value="20">Saab</option>
<option value="30">Opel</option>
<option value="45">Audi</option>
</select>
<input type="submit" class="temp" value="submit the answer">
<script>
var t;
if () {
t=value;
} else if () {
t=value;
} else if () {
t=value;
}else {
t=value;
}
</script>