I am trying to check if there is at least 1 digit in an input field. If there is I want to change the default image.
I am getting an error with the .isNumeric function. I know in the docs it shows $.isNumeric, but I am not sure how to add that within hasNumber.isNumeric().length >= 1;.
I am open to a different function if it will allow this to work.
$('#register').keyup(function() {
var hasNumber = $("#password").val();
var hasNumberValid = hasNumber.isNumeric().length >= 1;
$('#upperCase').attr('src', hasNumberValid ? 'https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcQlyqJ14HYP1WclpK9RkJWo8jIDBkhTW0GS31AxRkozAEA72ULhY89LIzk' : 'icons/collection/delete.png');
});
#password-check {
margin: 30px auto;
}
.password-check-field {
color: black;
}
.password-check-field img {
margin-right: 15px;
height: 15px;
width: 15px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<form action="" method="POST" id="register">
<div class="field">
<label for="firstname">First Name</label>
<input type="text" name="firstname" required>
</div>
<div class="field">
<label for="password">Choose a password</label>
<input type="password" name="password" id="password" required>
</div>
<div class="password-check-field">
<img id="upperCase" src="icons/collection/delete.png" alt="Success">Your password has at a number in it
</div>
</form>
$.isNumeric(hasNumber)var isNumeric = $.isNumeric(value_to_check);$.isNumeric(hasNumber)$.isNumeric"... so use that?