Home >Web Front-end >HTML Tutorial >Html Select uses the selected attribute to set the default selection

Html Select uses the selected attribute to set the default selection

不言
不言Original
2018-05-08 14:51:164128browse

This article mainly introduces how to use the selected attribute to set the default selection in Html Select. It has certain reference value. Now I share it with you. Friends in need can refer to it.

How to make the default selection in Html Select , as long as you add the selected = "selected" attribute to an option, it will be the default option. The following is an example. I hope it will be helpful to everyone.

Adding the selected = "selected" attribute to an option will be the default option.
For example :

##Copy code##The code is as follows:

<select id="isAudit" name="isAudit"> 
<option value="2">全部</option> 
<option value="1" selected = "selected">通过</option> 
<option value="0">未通过</option> 
</select>

Then "Pass" is selected by default ##.

#

The above is the detailed content of Html Select uses the selected attribute to set the default selection. 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