Right event (jQuery)
Two kinds of writing:
- .contextmenu()
. 1 <Script> 2 // right mouse button events . 3 $ (Document) .contextmenu ( function (E) { . 4 e.preventDefault () // stop the default behavior of the context menu . 5 the console.log ( 'the this' + the this ) . 6 Console. log ( 'E' + E) . 7 the console.log ( 'e.target' + e.target) . 8 }) . 9 </ Script>
- mouseDown + e.which
. 1 <Script> 2 $ (Document) .mousedown ( function (E) { 3 // Alert (e.which) // left mouse button. 1 = left; 2 = mouse button; 3 = right mouse button . 4 IF (E. ==. 3 Which ) { . 5 e.preventDefault () // prevent the default behavior . 6 the console.log ( 'the this' + the this ) . 7 the console.log ( 'E' + E) . 8 the console.log ( 'e.target' + e.target) . 9 } 10 }) . 11 </ Script>