I've noticed that when i open a modal and it is ready, it is firing onchange
event twice immediately. As far as i know, it should only occur when related element loses the focus. When i change that event to oninput
, it is also not working that i expected and not firing immediately after the modification. Is this an issue with modals or is it just me? Am i missing something? Here's a sample for sign up modal:
...
extend(SignUpModal.prototype, 'fields', function(items) {
items.replace('username', m('.Form-group', [
m('input[type=text].FormControl', {
name: 'username',
...
onchange: console.log('something changed'), // firing twice
...
})
]), 30);
});
extend(SignUpModal.prototype, 'onready', function() {
console.log(this.$('[name=username]')); // executing twice ?
...
});
...