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

How to set jquery elements to be unusable

coldplay.xixi
Release: 2021-01-13 17:11:20
Original
1497 people have browsed it

Methods to set jquery elements that cannot be used: Use the [.prop()] method to adjust the properties of the element. After setting the button to disabled, the button will turn gray and cannot be clicked. The code is [$(" button").prop("disabled", true);].

How to set jquery elements to be unusable

The operating environment of this tutorial: windows7 system, jquery3.2.1 version, Dell G3 computer.

Methods that cannot be used to set jquery elements:

We can use jQuery to change non-CSS attributes of HTML elements. For example, you can disable buttons.

When you set the button to disabled, the button will turn gray and cannot be clicked.

jQuery has a .prop() method that allows you to adjust the properties of elements.

The following code shows how to disable all buttons:

$("button").prop("disabled", true);
Copy after login

Example: Let the target1 button be disabled



jQuery Playground

#left-well

#right-well

Copy after login

Related free learning recommendations: javascript( video)

The above is the detailed content of How to set jquery elements to be unusable. 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!