js click on blank space to trigger event

We often click on the blank space to close the pop-up box or trigger an event
<div class="aa" style="width: 200px;height: 200px;background-color: red;"></div>

js code
$(document).mouseup(function(e) {
		var _con = $('.aa'); // set the target area
		if (!_con.is(e.target) && _con.has(e.target).length === 0) {
			alert("4545");
		}
	});

When we click outside this div, an event will be triggered, where business and logic can be written

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326484812&siteId=291194637