JSFiddle - React, Tailwind, and code Playground
HTML
<input class="price" value="1234567" />
<input class="price" value="1234567" />
<input class="price" value="123456" />
<button>
Check!
</button>
JavaScript
$('button').click(function() {
var lengthcheck = $('.price').filter(function() {
return $.trim($(this).val()).length != 7;
}).length;
if (!lengthcheck) {
alert('valid!');
} else {
alert('not valid!');
}
})