I want to check if the input is empty or not while the user is typing
this is my code
$('#visitID').on('change', function () {
if ($('#visitID').val().length == 0) {
$("#saveandclosebutton").hide();
} else {
$("#saveandclosebutton").show();
}
});
but the saveandclosebutton never becomes hidden even though if my input is empty.
keypress/keyupevents because now your code will fire only when the input loses its focus after changing the value