使用jQuery启用按钮 [英] Enable button with jQuery

查看:70
本文介绍了使用jQuery启用按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在页面上有一个禁用状态的按钮.在下拉菜单中更改选择时,需要启用它.我正在尝试在CLICK函数中执行此操作:

I have a button on a page with disable state. I need to enable it when I change a selection in a drop down menu. I'm trying to do this inside CLICK function:

$("#myBtn").attr("disabled", "false");

...但是它似乎并没有影响它.还有另一种方法可以启用它吗?

... but it does not seem to affect it. Is there another way to enable it?

推荐答案

$('#myBtn').removeAttr('disabled')

disabled属性的存在会禁用该按钮-不管它的实际值是多少.

The presence of the disabled attribute disables the button - it doesn't matter what it's actual value is.

这篇关于使用jQuery启用按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆