can anyone help me how to turn on and off using a button.
current code:
<form>
<input type="button" value="one" disabled />
<input type="button" value="two" />
</form>
can anyone help me how to turn on and off using a button.
current code:
<form>
<input type="button" value="one" disabled />
<input type="button" value="two" />
</form>
You will need to use JavaScript. My example uses jQuery. The other examples cited are a little more complicated, so I made this for you.
// find the elements
var $form = $('form');
var $buttons = $form.find('input[type=button]');
// event logic
$buttons.click(function(e) {
$buttons.attr('disabled', false);
$(this).attr('disabled', true);
});
Put this in the onload or DomReady handler on your page. Check out the fiddle if you want: http://jsfiddle.net/G5e48/