i have a form with multiple select menus i want to make sure on submit that a user selected a value for each select menu how can i do that with jquery ? i tried something like
var form = $('myform');
if($(form ).find('select').length != $(form).find('select:option[selected="selected"]').length ) {
alert('wrong please make sure to select all select menu');
}
but no luck
please help
Thank you
The form object has already been created.I removed the
$()function from the form variables in theifstatement. You should also be using an identifier formyform.I recommend you prefix your
formvar with a$to note that you are already using a jquery object.Example: