javascript - Backbone.js events not firing when clicking on Icon-Font-Icon (sometimes text) on button -
my backbone click events won't fire when clicking on buttons icon fonts (like icon).
one view e.g. looks this:
var networkstatusview = backbone.view.extend({ template: _.template(helper.view('network/status')), events: { 'click a': 'navigate' }, navigate: function (el) { backbone.history.navigate($(el.target).attr('href'), true); return false; }, render: function () { this.$el.html(this.template(userlocation.tojson())); return this; }
});
in template a"button" looks (yeah, it's bootstrap ;)):
<a href="/link" class="btn"><i class="icon-info-sign"></i> Über</a>
have got idea why these events fire when clicking on borders, paddings , freespace of button won't fire when clicking on icon (and on text)?
thanks!
the solution (thanks @nekaab !) worked me:
change el.target el.currenttarget, navigate function this:
navigate: function (el) { backbone.history.navigate($(el.currenttarget).attr('href'), true); return false; }
hopefully :) - again answeres!
Comments
Post a Comment