在javascript中单击另一个按钮后激活按钮
activate button after another button click in javascript
我有三个按钮,点击一个按钮后,第二个必须访问点击,然后是第三个。当我点击第三个按钮时,它不应该工作
<input type="button" value="button" id="one" onclick="show()" action="">
<input type="button" value="button" id="two" onclick="show1()">
<input type="action" value="button" id="three">
<script>
function show{
}
</script>
首先禁用第二个和第三个按钮,使用:
<input type="button" value="button" id="two" onclick="show1()" disabled="disabled"/>
<input type="action" value="button" id="three" disabled="disabled"/>
并使用以下代码:
function show()
{
document.getElementById('two').removeAttribute('disabled');
}
// And Same For Second Button Click
function show1()
{
document.getElementById('three').removeAttribute('disabled');
}
jQuery在这里会更好:
$('#one').click(function () { // on a click on the button with id 'one'
$('#two').trigger('click');// trigger the click on second, and go on
}
使用此方法,您可以使用特定元素上的事件触发其他元素上的事件!
<script>
function show(){
$('#button1').attr('disabled',false);
$('#button2').attr('disabled',false);
}
function show1(){
$('#button2').attr('disabled',false);
}
</script>
你在找这个吗
$("input").click(function(){
$("input").attr('disabled','disabled');
$(this).next().removeAttr('disabled');
});
你可以使用Jquery绑定一个事件到点击。在那里做你想做的:
$('#ButtonID').bind('click',function(){
$('#ButtonID2').show();
//or
$('#ButtonID1').removeAttr('disabled');//if you want it be shown but not enabled
});
这是用来禁用按钮的:
$('#ButtonID').attr('disabled','disabled');
相关文章:
- 如何通过按键激活按钮应用CSS效果
- 我必须点击两次才能激活任何按钮操作(离子/角度)
- 如何在ASP.NET中单击按钮后激活启动选项卡
- 在单击按钮时激活按钮的悬停状态,直到单击另一个按钮(Javascript/JQuery)
- 如何在使用jquery向数据库发送数据时取消激活的按钮
- 将按钮绑定到几个基于文本框中值的大小而激活的文本框
- 如何使用jQuery激活按钮
- 新创建的按钮(通过createElement(“button”))激活自身.如何阻止这种情况
- jQueryui上的两个复选框选中需要按钮激活和未选中禁用
- 如何使用Xpages onchange事件激活按钮
- 如何使用按钮激活键盘
- 如何使用 img 而不是按钮激活 jQuery 函数
- java脚本中的非模态警报消息,由按钮激活
- jquery验证(使用jquery验证插件)-根据单击的按钮激活特定元素的验证规则
- 使一个按钮激活JavaScript代码
- 单击其他按钮后使按钮激活
- 启动数据切换下拉由单选按钮激活
- 我如何使一个按钮激活JavaScript
- 当按钮激活Class.时,在Div上切换Class
- 将按钮激活的图像滚动器制作成自动滚动器