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; 

working example


Comments

Popular posts from this blog

java - How to compare two classes -

javascript - Why Selenium can't find an element that is graphically visible -

c# - Get the Class name in a class with atribute inside a attribute method -