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);].
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);
Example: Let the target1 button be disabled
jQuery Playground
#left-well
#right-well
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!