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

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -