javascript - CanJS right click event -
how can bind right click event in canjs?
i've attempted following, guess click captures left clicks (as ev.which doesn't log 3 on right clicks).
'.btn click': function (el, ev) { console.log(ev.which); switch(ev.which) { case 1: var val = 1; break; case 3: ev.preventdefault(); var val = -1; break; } var item = can.data(el.closest('tr'), 'item'); item.attr('rel', item.rel + val); }
i don't know canjs is, use oncontextmenu
:
elem.oncontextmenu = function(e) { e = e || window.event; if(e.preventdefault) e.preventdefault(); e.returnvalue = false; // code };
Comments
Post a Comment