Want to implement a confirmation message for users before submitting their form using
onClick="return confirm('are you sure ?')"
.
The basic form structure is as follows:
<form>
<Select name='val[]' class='select'><option></option><option value='a'>a</option><option value='b'>b</option><option value='c'>c</option><option value='d'>d</option></select>
<Select name='opt'><option>AAA</option><option>BBB</option><option>CCC</option></select>
<input type='submit' name='submit' value='submit' onClick="return confirm('are you sure ?')">
</form>
If the user clicks submit, how can I update the confirmation message to display the values they have selected from the dropdown menus?
Edit:
This page is utilizing the Jquery Chosen script available at
The first option is a multiselect dropdown and styled using chosen.
The suggested solution provided by dishwasherWithProgrammingSkill works but does not show the multiple values selected.
Is there a way to achieve that functionality?
Update:
Using : var opt3=$('#opt1').val();
The above code returns a comma-separated list. How can I remove the commas?
Appreciate any help. Thank you!