my code:
Template.settings.events({
// i tried with 'change #fileInput': function(e) { ... } but not work too.
'change input[type=file]': function(e) {
console.log(e);
alert('ok');
}
});
template:
<input type="file" id="fileInput" name="file" class="form-control file" >
what hapend ? please help !
It should work so you’ll have to debug elsewhere in your code. Here’s a quick repro showing it working:
-
meteor create input-test
-
Replace client/main.html
with:
<body>
<form>
<input type="file" id="fileInput" name="file" class="form-control file" >
</form>
</body>
- Replace
client/main.js
with:
import { Template } from 'meteor/templating';
import './main.html';
Template.body.events({
'change input[type=file]'(event) {
console.log(event);
},
});
Output:

i see the problem: i use this package: useful:forms
this override event, so it not work !
import { Forms } from 'meteor/useful:forms';
Forms.mixin(Template.settings);
thanks @hwillson so much !