我有一个 html 表单,我想在没有提交按钮的情况下提交该表单。我应该使用什么事件监听器?谢谢!
editProfile.html
<form class="edit-profile" enctype="multipart/form-data">
Upload Profile Image:
<Input type="file" name="profileImage" id="profileImage" onchange="this.form.submit()">
<br>
</form>
editProfile.js
Template.editProfile.events({
"change .edit-profile": function(event){
console.log("works");
}
});
最佳答案
它应该与提交表单
一起使用或使用其类,例如:
Template.editProfile.events({
"submit .edit-profile": function(event){
console.log("works");
}
});
关于javascript - 我应该使用什么 Meteor 事件处理程序来提交 onchange 表单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34564482/