Possible Duplicate:
Javascript , event handler is always called, even if the event is not raised
I'm new to Backbone.js and I have an issue with an event.
In my appView.js, I have just this :
var languagesView = new app.LanguagesView();
And this languagesView.js :
var app = app || {};
$(function() {
app.LanguagesView = Backbone.View.extend({
initialize: function(){
this.on("foo", this.fooFunction());
},
fooFunction: function() {
console.log("---FOO----")
}
});
});
I have no trigger in my app and I don't understand why the fooFunction
is always called when I open my page. Is there something I have misunderstood about the events?