Latest news
Home » jQuery » How to loop through array in jquery

How to loop through array in jquery

if(jQuery.trim(jQuery(“#custom-email-input”).val()) != ”) {

var sCustomemails = jQuery(“#custom-email-input”).val().split(‘,’);
jQuery.each(sCustomemails, function(index, email) {
if(!validEmail(email)) {
jQuery(“#custom-email-input”).addClass(‘error’);
alert(‘Please enter only valid email addresses.’);
jQuery(“#custom-email-input”).attr(‘placeholder’,’Please enter only valid email addresses’);
error=true;
} else {
jQuery(“#id_subject”).removeClass(‘error’);
}
});

}

Leave a Reply

x

Check Also

How to Check Expired Sessions using jQuery Ajax and PHP

We can achieve using the php and ajax.The following ajax call execute in every 10 ...