jQuery, Tutorials

Click anywhere on Page except Specific div in jQuery

10 January 2019

How can I trigger function if I click anywhere on the page except one div element ? Here we will see how to click anywhere on Page except Specific div in jQuery.

Here take and example, suppose the div or element ID is “ccEle”.

You can apply click on body of document and cancel click processing if the click event is generated by div with id ccEle, This will bind event to single element and saving binding of click with every element except ccEle


       if(evt.target.id == "ccEle")
       // Check if click was triggered on or within #ccEle

      //Do processing of click event here for every element except with id ccEle

Leave a Comments