I’ve almost tried everything and even exactly copied the example: [in here][1]
However I can’t get to see it work it. I’ve tried multiple alternations for the event binding but none of them seem to work. What can be the possible reason?
Div container;
Load
My event binding trials;
el: '#container',
events: {
"click button": "render"
}
Also;
el: '#container',
events: {
"click button#add": "render"
}
And finally this;
el: '#container',
events: {
"click input[type=button]": "doSearch"
}
Is there any possibility of that I’m doing this wrong. Besides if I get it to work, would it be possible to assign click event for each function in the div, giving their id’s instead of a more general “click button”: “render”?
NOTE: I couldn’t get the html code wrapped in code tag.
Is your input button a child element of container? Backbone won’t find elements outside the scope of the view’s element.
You can do “click #add” provided #add is a child element of #container.