Skip to content

Events that trigger the element when clicking on an area other than the element

Notifications You must be signed in to change notification settings

tiger986/triggerEvent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

Events that trigger the element when clicking on an area other than the element

HTML code

<div class="box">
    <div class="d1">Click outside</div>
</div>

JS code

$(function(){		
    $(document).click(function(e){
        var target = $(e.target);
	if(target.closest('.d1').length == 0){
            alert("Clicking on the outside of d1");		
	}
    });	
})

About

Events that trigger the element when clicking on an area other than the element

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages