Home  >  Article  >  Web Front-end  >  What is the way to make a button unavailable in jquery

What is the way to make a button unavailable in jquery

王林
王林Original
2020-11-24 11:09:052917browse

jquery使按钮不可用的方法是:【$("#btn").attr("disabled", true);】。我们还可以通过js来实现,如【document.getElementById("btn").disabled = true;】。

What is the way to make a button unavailable in jquery

本教程操作环境:windows10系统、jquery2.2.4版,该方法适用于所有品牌电脑。

(学习视频分享:javascript视频教程

有如下三种实现方式:

html代码

<input type=&#39;button&#39; value = &#39;提交&#39; id=‘btn’/>

javascript代码

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

jquery代码

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

相关推荐:js教程

The above is the detailed content of What is the way to make a button unavailable in jquery. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:When to use vuexNext article:When to use vuex