如何在默认情况下显示禁用HTML选择选项? [英] How to show disable HTML select option in by default?
问题描述
我是HTML和PHP的新手,希望从mysql表格中实现下拉菜单并进行硬编码。我在我的页面中有多个选择,其中之一是
I am new to HTML and PHP and want to achieve a drop-down menu from the mysql table and hard-coded too. I have multiple select in my page, One of them is
<select name="tagging">
<option value="">Choose Tagging</option>
<option value="Option A">Option A</option>
<option value="Option B">Option B</option>
<option value="Option C">Option C</option>
</select>
现在问题在于用户也可以选择选择标记作为他的标记,但我只想提供他从可用的三个中选择。我使用禁用作为
Problem is now that user can also select "Choose Tagging" as his tagging but i only want to provide him to chose from available three. I used disable as
<select name="tagging">
<option value="" disabled="disabled">Choose Tagging</option>
<option value="Option A">Option A</option>
<option value="Option B">Option B</option>
<option value="Option C">Option C</option>
</select>
但现在选项A成为默认选项。所以我想默认设置为选择标记,并且希望将其从选择中禁用。这是做到这一点的一种方式吗?同样的事情需要用其他选择来完成,这将从Mysql获取数据。任何建议都是可以接受的。
But now "Option A" became the default one. So i want to set "Choose Tagging" as by default and also want to disable it from selection. Is it a way to do this. Same thing need to be done with other select which will fetch data from Mysql. Any suggestion will be appreciable.
推荐答案
使用
use
<option selected="true" disabled="disabled">Choose Tagging</option>
这篇关于如何在默认情况下显示禁用HTML选择选项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!