<button class="year" name="date">
Year
</button>
<button class="mouth" name="date">
Mouth
</button>
<button class="day" name="date">
Day
</button>
let buttons = document.getElementsByName("date");
for(let btn of buttons) {
btn.addEventListener("click", function(e) {
e.target.dataset.ready = true;
let isReady = true;
for(let btn of buttons) {
if(!btn.dataset.ready) {
isReady = false;
}
}
if(isReady) {
console.log("Сюда можете вставить ваш код");
}
});
}
let clickCount = 0;
$(".year, .mouth, .day").click(function (event) {
if (clickCount === 3) {
console.log( new Date(event.targer));
}
});
<body>
<button name="bt" value="1">1</button>
<button name="bt" value="2">2</button>
<button name="bt" value="3">3</button>
<script>
let sum=0;
let s=document.getElementsByName('bt');
s.forEach(item=>item.onmousedown=()=>btclick(item))
let btclick=(bt)=>{
sum=sum+parseInt(bt.value)
console.log(bt.value+' pressedDown'+' sum='+sum);
bt.style.background='green'
bt.onmousedown=()=>btUnClick(bt)
testAllBtIsPress(sum)
}
let btUnClick=(bt)=>{
bt.style.background='grey';
bt.onmousedown=()=>btclick(bt);
sum=sum-parseInt(bt.value)
console.log(bt.value+' pressedUP'+'sum='+sum);
}
let testAllBtIsPress=(a)=>{
if (a===6){alert('ТАДАМ!! AllButtonsPressed')}
}
</script>
</body>