In the following function it goes through the if and the else, why is that?
function test(){
$(".notEmpty").each(function() {
if($(this).val() === ""){
alert("Empty Fields!!");
return;
}
else{
AddRow_OnButtonClick('tblMedicationDetail',6);
}
});
}
Is there any if and else statement on jquery that I am not aware of?
AddRow_OnButtonClick is a function to add a new row with 6 textboxes which I am attaching a className 'notEmpty' if any of the text boxes are empty the function AddRow_OnButtonClick should not be called and an alert should pop up.
I dont know what am I doing wrong.
Thanks