【问题标题】:How turn on and off a disable button [closed]如何打开和关闭禁用按钮[关闭]
【发布时间】:2014-03-09 14:41:35
【问题描述】:

谁能帮助我如何使用按钮打开和关闭。

当前代码:

<form>
<input type="button" value="one" disabled />
<input type="button" value="two"  />
</form>

【问题讨论】:

标签: javascript php html mysql


【解决方案1】:

您将需要使用 JavaScript。我的示例使用 jQuery。 引用的其他示例稍微复杂一些,所以我为您制作了这个。

// 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);
});

将它放在页面上的 onload 或 DomReady 处理程序中。如果需要,请查看小提琴: http://jsfiddle.net/G5e48/

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-09-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多