javascript - How to prevent onclick event on a div while clicking on body click? -


i functionality body,html elements while clicking on anywhere on document , there div tag onclick event there. both clashing each other how prevent while clicking on div. tried both event stop propagation , event prevent defaul example: jd nothing jquery

$jd =  jquery  

the below event should triggered particular div. t event clashing body onclick.

$jd('.menu-left a').click(function(){             $jd('.menu-left a').removeclass('active');                       if($jd(this).hasclass('add_item_team')) self.team.create();             if($jd(this).hasclass('add_item_qrcode')) self.qrcode.open();             $jd(this).addclass('active');             jquery("#text-lock").trigger("click");         });  jquery(document).on('click','body',function(event){ /*console.log("adsfasddfs");         var finding_span;     finding_span = $jd(".design-area").find('.content-inner span.drag-item');       if(event.target.id == "dg-left"){      return false;      }else{         if(finding_span.length>0){          console.log("cameeeee");         design.item.unselect();          }      }*/      var finding_span;     finding_span = $jd(".design-area").find('.content-inner span.drag-item');       if(finding_span.length>0){         design.item.unselect();     } 

jquery(document).on('click','body',function(event){     event.preventdefault();     event.stoppropagation();      var finding_span;     finding_span = $jd(".design-area").find('.content-inner span.drag-item');       if(finding_span.length>0){         design.item.unselect();     } 

hope may you


Comments

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -