jquery - Working with the body element -


i have page (figure below) div#content centered in body. want right-click in body area, outside of div#content, , read color there. if try

 $(document).on("contextmenu", "body", function(el){       bodybackgroundcolor = $(el).css('background-color');       debugger;  }); 

i don't catch interrupt when click in wings.

if try

 $(document).on("contextmenu",function(el){           bodybackgroundcolor = $(el).css('background-color');           debugger;      }); 

i catch interrupt el = document, $(el).css('background-color') doesn't work.

how should doing this?

thanks.

body element

i think need background-color applied on element right-clicked. if try this.

demo

el in callback not element event, can element e.target or event.srcelement work

$(document).on("contextmenu",function(e){           bodybackgroundcolor = $(e.target).css('background-color');           alert(bodybackgroundcolor);      }); 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -