nasir142
nasir142

Reputation: 83

Click Event is Not Firing

My click Event is not Firing in backbone.js.I have search alot but my problem is not resolved. following is the code:

EventView=Backbone.Model.extend({

   el:'modal_box',
events: {
    'click  #btn': 'insertText',
    'click .btndel': 'delme'
},


insertText: function (e) {
    alert('text inserted');
},
delme: function (e) {
    alert('text inserted');
}

}); AND HTML IS

<div class="modal_box">
<button id="btn"  >Add a Task </button>
<button class="btndel"  >delete all</button>

Upvotes: 0

Views: 76

Answers (1)

Aditya R.
Aditya R.

Reputation: 71

For "el", you should supply a selector. Try:

el: '.modal_box',
...

Upvotes: 2

Related Questions