How to lock bottons in web site using HTML and by pressing unlock botton to unlock the botton | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to lock bottons in web site using HTML and by pressing unlock botton to unlock the botton

please

20th May 2017, 12:18 PM
Sai Venkat
Sai Venkat - avatar
2 Answers
+ 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>
20th May 2017, 12:22 PM
Burey
Burey - avatar
+ 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.
20th May 2017, 11:30 PM
Kirk Schafer
Kirk Schafer - avatar