Да, это возможно. Вы можете проверить это:
<!DOCTYPE HTML>
<html>
<head>
<style>
#div1, #div2 {
float: left;
width: 100px;
height: 35px;
margin: 10px;
padding: 10px;
border: 1px solid black;
}
#button2 {
display: none;
}
</style>
<script>
function moveButton(e) {
let btn1 = document.getElementById('button1');
let btn2 = document.getElementById('button2');
let btn_id = e.target.id;
if(btn_id == "button1"){
e.target.style.display = 'none';
btn2.style.display= 'block';
} else {
e.target.style.display = 'none';
btn1.style.display= 'block';
}
}
</script>
</head>
<body>
<div id="div1">
<button id="button1" onClick="moveButton(event)">Click Me</button>
</div>
<div id="div2"><button id="button2" onClick="moveButton(event)">Click Me</button></div>
</body>
</html>