if ($('#requestForm').val == "") {
alert('Please select at least one filter');
//return false;
}
else {
///Run my code
}
I have a form, no inputs are required, but if no inputs are selected I want an alert to tell them to select at least one option.
var validate= false;
$('#requestForm input').each(function(){
if($(this).val() != '' || $(this).attr('checked'))
validate = true;
});
if(!validate){
alert('Please select at least one filter');
return false;
}
else {
Run my code
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With