html5 - How to enable a disabled button by clicking on another button? -


i have 2 buttons:

<button onclick=initialize() id="1" data-role="button" data-mini="true" data-corners="false" data-theme="b">show position</button> <button onclick=calcroute() id="2" data-role="button" data-mini="true" data-corners="false" data-theme="b">evacuate !</button> 

i want have second button disabled default, , have enabled if clicking on first button. how accomplish this?

please see following answers questions:

the simplest approach (just pure example w/out taking consideration browsers, etc):

<html> <head>     <script>         function enablebutton2() {             document.getelementbyid("button2").disabled = false;         }     </script> </head> <body>     <input type="button" id="button1" value="button 1" onclick="enablebutton2()"  />     <input type="button" id="button2" value="button 2" disabled /> </body> </html> 

Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -