I have an IF statement very similar to this Fiddle here:
What I'm wanting to know is, how do I display the alert() only once ALL divs with the .ccn class have a value over 1000, not just the first instance. I have tried the each() function but I'm not too sure how to use it.
$(".ccn").keyup(function() {
if ($(".ccn").val() >= 1000)
alert('test');
});
<div class="cardNumber">
<input type="text" value="" maxlength="4" name="ccn" class="ccn">
<input type="text" value="" maxlength="4" name="ccn" class="ccn">
<input type="text" value="" maxlength="4" name="ccn" class="ccn">
<input type="text" value="" maxlength="4" name="ccn" class="ccn">
</div>
<ul>
<li class="checkNumber">Card Number</li>
</ul>
Aucun commentaire:
Enregistrer un commentaire