I want to make alert messages when input of review text or author name are empty. Now when this fileds are empty submit button just dont work, but I want alert message to be popped up.
I added thi code for that:
jQuery('#commentform').submit(function(e){
if(jQuery('#comment').val() == ''){
alert('Please leave a message!');
return false;
}
else
if(jQuery('#author').val() == '' && jQuery('#author').val() !== undefined){
alert('Please enter your name!');
return false;
}
});
But this does not work, I think thats because another jQuery(‘#commentform’).submit() method declared in another file. Please tell me how can handle this?