<html>
<head>
<style>
form{
width: 200px;
height: 100px;
border: 1px solid red;
}
div{
display: inline-block;
width: 50px;
height: 50px;
border: 1px solid green;
}
</style>
</head>
<body>
<form action="">
<div>1</div>
<div>2</div>
<div>3</div>
<button disabled>кнопка</button>
</form>
<script>
document.querySelectorAll('div').forEach((el)=> el.addEventListener("click", function(e){
e.stopPropagation();
document.querySelector('button').disabled = false;
})
);
document.querySelector('form').addEventListener("click", function(e){
document.querySelector('button').disabled = true;
});
</script>
</body>
</html>