I have a div with id=\"content-area\", when a user clicks outside of this div, I would like to alert them to the fact that they clicked outside of it. How would I use JavaSc
use jquery as its best for DOM access
$(document).click(function(e){ if($(e.target).is("#content-area") || $(e.target).closest("#content-area").length) alert("inside content area"); else alert("you clicked out side content area"); });