Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jquery count all empty fields

Is there a way in jquery to count all empty inputs and textareas in a form, for the following types

checkbox, date, datetime, email, month, number, radio, tel, text

because every form has a js variable maxInput. if maxInput is 6 (form has 6 inputs) then if you count the inputs and it is 6 i know that all is filled. Does anybody knows how to complete this.

like image 407
Bham Avatar asked Mar 16 '23 08:03

Bham


1 Answers

Suppose all inputs has a class named: yourClass then this may help you:

$('.yourClass').filter(function(){
return !$(this).val();
}).length;
like image 111
Salah Akbari Avatar answered Mar 28 '23 12:03

Salah Akbari