Reputation: 280
I am trying to invoke method after losing focus, unfortunately my Jquery doesn't invoke .focusout method.
Code:
$("#account-number").focusout(function() {
console.log("number ready");
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<form class="col-sm-8">
<div class="form-group" id="number">
<label for="exampleFormControlInput1">Account number</label>
<input type="account-number" class="form-control" id="account-number" placeholder="1234 5678 1234 5678">
</div>
</form>
script is linked properly, other JS functions are working.
Upvotes: 0
Views: 30
Reputation: 1053
Just do the following:
$(document).on("focusout","#account-number",function(){ alert("number ready"); });
Why this is happening? I do not know, but this is what I try when all else fails. I have read that this is actually logical and to be expected on input elements, but I cannot find the resource.
Upvotes: 1