I was trying to validate my phone number. Everything is working except the validate 10 digit part
if ($(".phone").val() == "") {
phoneerror = "Please enter phone number";
} else if (!($.isNumeric($(".phone").val())) && $(".phone").val() != "") {
phoneerror = "this field cannot contain letters";
} else if ($(".phone").val().length !== 10) {
phoneerror = "Must be 10 Digits";
} else {
phoneerror = "";
}
console.log(phoneerror);
<script
src="https://code.jquery.com/jquery-3.3.1.min.js"
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8="
crossorigin="anonymous"></script>
<input type="text" class="phone" value="12345">
can someone please tell me what is the wrong with my code