I have a submit buttons which sends the info to MySQL. If the submit button is clicked when the radio button is ‘yes’ and the drop down value is ‘please select’ I want the validation error to pop up. Currently it pops up when ‘yes’ radio button Is selected.
$( function(){
$("input[name='discount']").click(function() {
var isDisabled = (this.value == 'No');
$("#colour1, #shade1").prop("disabled", isDisabled);
if(!isDisabled){
//Please select option is selected
if($("#colour1")[0].selectedIndex == 0){
alert('Please select color');
}
//Please select option is selected
if($("#shade11")[0].selectedIndex == 0){
alert('Please select shade');
}
}
});
});
Try this.