How to check if all input values are empty in jquery each? -


i have each , need check if input fields empty , action. did following

jquery(".page-template-sitecheckout .mainwrapper .shipping_addresses_checkout_view.checkout_shipping_column_withoutmargin .form-row.validate-required input").each(function () {         var checkoutfieldsvalue = jquery(this).val();         if(checkoutfieldsvalue === ''){             jquery(this).parent().addclass('checkout_invalid_fields_parent');             jquery(this).addclass('checkout_invalid_fields');         }else{           jquery(this).parent().removeclass('checkout_invalid_fields_parent');             jquery(this).removeclass('checkout_invalid_fields');             jquery('.checkout_btn_prev_to_shipping').fadein().show();             jquery('.page-template-sitecheckout .mainwrapper .shipping_addresses_checkout_view').fadeout().hide();             jquery('.page-template-sitecheckout .mainwrapper .billing_info_checkout_view').fadein().show();             jquery('.checkout_btn_prev_to_cart, .checkout_btn_next_to_billing').fadeout().hide();         }     }); 

with code when 1 input has value passes else statement. how can check every single input field value emptiness , action?

thanks in advance.

i think expecting.

var count=0; $('.page-template-sitecheckout .mainwrapper .shipping_addresses_checkout_view.checkout_shipping_column_withoutmargin .form-row.validate-required input').each(function(){ if($(this).val == ""){ count++; } }); if(count == 0) { //do here } 

Comments

Popular posts from this blog

serialization - Convert Any type in scala to Array[Byte] and back -

matplotlib support failed in PyCharm on OSX -

python - Matplotlib: TypeError: 'AxesSubplot' object is not callable -