In my code I want a button to be clickable once. I put 2 buttons below me because I want to disable the other button for use when one of the buttons are clicked. Help asap thank you very much!
<div style = "position:absolute; left:625px; top:100px; background-color:white;">
<button type="button" onclick="alert('The guy walks away disapointed, I think I made the wrong decision')" >Detain</button>
<button type="button" onclick="alert('The guy sighs in relief and looked happy. The guards guide him to the exit. I think I made the right decision')">Free them</button>
</div>
2
Answers
Use:
this.style.display='none';
within onclick inside the div you want to remove:
Maybe you use
this.disabled='true';
I’d recommend you this code.