javascript - Check if all input field lengths are 7 -
there multiple input fields common class. need check if length of fields 7.
this tried, if length of fields 7, if (!lengthcheck)
doesn't execute.
var lengthcheck = $('.price').filter(function(){ return !$.trim($(this).val()).length != 7; }).length; if(!lengthcheck){ //go ahead }
your issue because logic check reversed. need remove leading !
:
return $.trim($(this).val()).length != 7;
Comments
Post a Comment