Reputation: 123178
Testing a simple input:
<input type="file"/>
The input
event does not fire when a new file is selected:
$('input').on('input', function(event){
console.log('input value changed', event.target.value)
})
The change
event fires:
$('input').on('change', function(event){
console.log('input value changed', event.target.value)
})
Why doesn't the 'input' event fire?
Upvotes: 0
Views: 70
Reputation: 11558
The supported elements for the input event are limited to textArea, input type=text, or input type=password. From MSDN:
Input event occurs when the text content of an element is changed through the user interface.
You can use the oninput to detect when the contents of a textArea, input type=text, or input type=password have changed. This event occurs immediately after modification, unlike the onchange event, which occurs when the element loses focus.
Upvotes: 0