I need help with strange behavior of my javascript/jQuery code.
jQuery .change()
of simple text input executes only if i click on page or chrome console or press some key on keyboard, but not when i type text in my text input.
Sure, I expect, that code will be executed after each change in text input, but now this looks like:
- I type something in text input
- Nothing happens
- I click anywhere in the document or press a key, let's say, "tab"
- Code runs as expected
Can someone explain me whats going on?
Му code is simple:
$('#search_field').change(function() {
alert("test")
})
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input type="text" name="search_field" class="form-control" id="search_field" placeholder="Search" />