Home > Web Front-end > HTML Tutorial > How to use disabled attribute

How to use disabled attribute

不言
Release: 2019-02-12 13:08:44
Original
12742 people have browsed it

The disabled attribute is a Boolean attribute, which stipulates that the input element should be disabled. Disabled input elements are unavailable and cannot be clicked. In the following article, we will take a look at the specific usage of the disabled attribute.

How to use disabled attribute

We can set the disabled attribute to prevent users from using the element until other conditions are met (such as selecting a checkbox, etc.). JavaScript can then remove the disabled value and make the element available.

Let’s look at a specific example

The code is as follows

<!DOCTYPE html>
<html>
<head>
   <title></title>
</head>
<body>
<form action="/action_page.php">
  First name: <input type="text" name="fname"><br>
  Last name: <input type="text" name="lname" disabled><br>
  <input type="submit" value="Submit">
</form>
</body>
</html>
Copy after login

The effect is as follows: If the element has a disabled attribute, it will turn gray and cannot be used.

How to use disabled attribute

This article ends here. For more exciting content, you can pay attention to other related column tutorials on the PHP Chinese website! ! !

The above is the detailed content of How to use disabled attribute. 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