Home > Web Front-end > JS Tutorial > body text

What is the way to make a button unavailable in jquery

王林
Release: 2020-11-30 13:39:04
Original
2997 people have browsed it

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’/>
Copy after login

javascript代码

document.getElementById("btn").disabled = true;
Copy after login

jquery代码

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

相关推荐: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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!