The view part of my code using Backbone.js is something like this:
var myView = Backbone.View.extend({
events: {
'focus .cell input' : "updateCurrentCell"
},
updateCurrentCell: function(event) {
console.log('updateCurrentCell called');
// Update the current cell.
}
}
Whenever the input element gets focus, the function is called twice. I tried printing the stack trace using console.trace()
. It shows that once the function call originated from focus event while the next time from focusin.
My attempts to find out how to prevent one of these events getting fired lead me nowhere. How can I fix this?