Home > Article > Web Front-end > Html Select uses the selected attribute to set the default selection
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!