Skip to content

Instantly share code, notes, and snippets.

@mrtag23
Last active October 5, 2020 18:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrtag23/84c088805dd658584ad0538afd4a545d to your computer and use it in GitHub Desktop.
Save mrtag23/84c088805dd658584ad0538afd4a545d to your computer and use it in GitHub Desktop.
Detects focusing out of a container.
$(function(){
var wrapper = document.getElementsByClassName('thewrapper')[0];
wrapper.addEventListener('focusout', function(event) {
if (wrapper.contains(event.relatedTarget)) {
return;
}
console.log('out of the wrapper');
});
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment