简体   繁体   English

点击事件未触发

[英]Click Event is Not Firing

My click Event is not Firing in backbone.js.I have search alot but my problem is not resolved. 我的click事件未在bone.js中触发。我有很多搜索,但我的问题没有解决。 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 和HTML是

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

For "el", you should supply a selector. 对于“ el”,应提供一个选择器。 Try: 尝试:

el: '.modal_box',
...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM