$("#inputBoxWidth").change(function() {
var curValue = $("#inputBoxWidth").val();
alert(curValue);
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<form>
<input type="text" id="inputBoxWidth">
</form>
When I press enter key in all browsers I get the alert function working except IE. In IE I have to click outside of the input element so the input looses focus and than it works. I need IE behave the same as other browser when pressing enter the alert popup shows up with the current value. How to do achieve that?
What you can do is use the keyup event.
Which gives you :
$("#inputBoxWidth").keyup(function() { // Your code });
Don't use the keydown event because if you want to get the value of the input it will give the value before the key was pressed.
:)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With