View:
Member.Views.Popover = Backbone.View.extend({
template: "member/default",
tagName: 'a',
className: 'header-auth member',
events: {
'click a.member': 'toggle'
},
initialize: function() {
//todo
},
toggle: function(){
console.log("toggle");
}
});
Output:
<a class="header-auth member">
//content from template
</a>
First problem: first I defined just a template without tagName and className because this data was already set in the template. But this wrapped the template with a div. To avoid that I set tagName and className and removed this data from template because now it is set by backbone.
Second problem: now that I use tagName the click event does not work anymore.
Any ideas how to fix this?
您
可以
更改click a.member
以仅click
,因为该元素是您的视图。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.