Home  >  Article  >  Web Front-end  >  How to use disabled attribute

How to use disabled attribute

不言
不言Original
2019-02-12 11:13:2112706browse

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>

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!

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:How to use caption tagNext article:How to use caption tag