js和jquery设置disabled属性为true使按钮失效


本文向大家介绍js和jquery设置disabled属性为true使按钮失效,包括了js和jquery设置disabled属性为true使按钮失效的使用技巧和注意事项,需要的朋友参考一下

设置disabled属性为true即为不可用状态。

JS

document.getElementByIdx("btn").disabled=true;

jquery

$("#btn").attr("disabled", true);

html

<input type="button" value="提交" id="btn">