Paypal add to cart button form ignores the "return false" and submits. This script works on a desktop browser but it won't work on my iPhone. The input turns red, but the form still submits. It can be tested at membership form
$('input[name="submit"]').click(function() {
$(':input').each(function(input) {
if($(this).attr('required')) {
var required = $(this);
if(required.attr('pattern')) {
var patt = new RegExp(required.attr('pattern'),"i");
if( !patt.test( required.val() ) ) {
required.css('background-color','#f2dede');
return false;
}
}
else {
if(required.val() == '') {
required.css('background-color','#f2dede');
return false;
}
}
}
});
By placing an "e" in the function(e) for the event, and then use e.preventDefault() I was able to keep the form from submitting.