jquery check if clicked outside div
$(document).mouseup(function(e)
{
var container = $("YOUR CONTAINER SELECTOR");
// if the target of the click isn't the container nor a descendant of the container
if (!container.is(e.target) && container.has(e.target).length === 0)
{
container.hide();
}
});$(document).click(function(){
$("#try").hide();
});
$("#try").click(function(e){
e.stopPropagation();
});$(document).click(function() {
alert('clicked outside');
});
$(".menuWraper").click(function(event) {
alert('clicked inside');
event.stopPropagation();
});
Also in JavaScript:
- Javascript code for Age calculator chatbot
- json object check if key exists java
- javascript string get last two character
- jquery from object to queryselector
- picker change event react native
- detect logged user wordpress javascript
- difference between express() and express.router()
- react router go rprevious page
- play audio in javascript
- mongodb distancefield to kms
- : Cannot set the body fields of a Request with content-type "application/json".
- jquery for bootstrap 4
- javascript string change character at index
- Node Sass could not find a binding for your current environment
- repeat a function javascript
- convert date to unix timestamp javascript
- get page link angular
- how to draw horizontal line in canvas
- can we get the value of form control after disabling it angular
- useRef
- Should I learn Javascript?
- json_encode escape \
- strapi cloudinary how to use
- node filesystem change directory of a file