Basically what i'm doing is passing 8 form input values to a Javascript Ajax file, during this process i want to do an
if(in_array(all form values) == 'empty') {
Here is the current code i'm using
if($("#merchant").val()==='') {
//prevent submit button to sending to the handler page
event.preventDefault();
//popup the alert
$("#response").html("<br/><div class='alert alert-error'>Please enter a Merchant Name</div>");
$("#response").slideDown('slow');
slideout();
$("#loading").fadeOut('slow');
}
But using this code i have to copy and paste it about 8 times for each field, which i would rather do an array check if possible.
Is this possible with Javascript ? if so how ?