Jichao Jichao - 1 year ago 91
HTML Question

How can I set the default value for an HTML <select> element?

I thought that adding a

attribute set on the
element below would cause the
containing my provided
to be selected by default:

<select name="hall" id="hall" value="3">

However, this did not work as I had expected. How can I set which
element is selected by default?

Answer Source

Set selected="selected" for the option you want to be the default.

<option selected="selected">
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download