¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita0
How to lock bottons in web site using HTML and by pressing unlock botton to unlock the botton
please
2 Respuestas
+ 10
use disabled attribute
<button id="unlock"> Click to Unlock</buttom>
<button id="btn" disabled="true">Locked Button</button>
<script>
unlock = document.getElementById("unlock");
unlock.onclick=function(){
document.getElementById("btn").disabled=false;
}
</script>
+ 5
@Burey's answer is best. If you want to see a code where this precise thing is working:
https://code.sololearn.com/Wcw9kppQxRid/?ref=app
Just look at the two <button> tags (ignore the rest, even if it throws an error; the buttons still work).
The 'slow down' button disables itself when clicked, then it enables the 'stutter' button. You can see them go black/grey when enabled/disabled.