Jump to content

event creation in backbone


jimfog

Recommended Posts

I am trying to create an event in backbone...when the user starts typing in an input box a function should be called that emits an alert message.

 

Take a look at the jsbin here http://jsbin.com/silajo/25/

 

Find this code (jsbin does not have line numbers so I can guide you with precision):

 this.on("keyup input#name",this.test);  

Then...click right on the calendar...a popup box will appear with two input elements.

My tests relate to the title input element.

 

Normally...when the user starts typing in the title box an alert message should appear....but in my case it does not.

I do not even get a console error...the code seems not to run at all.

Link to comment
Share on other sites

Are you sure it's valid syntax to have both the event type and an element selector in the same string?

 

I'd imagine it probably should be something like this:

$("input#name").on("keyup",this.test);
Link to comment
Share on other sites

I'm not very familiar with Backbone. It says it can take a space-separated list of events, but is input#name an event?

 

They also say that their events module is intended for custom firing and catching events on Backbone objects, I don't think it listens for browser events or events on HTML elements.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...