Html Select Required

html select required
<select name="color" id="color" required>
<option value="" selected disabled hidden>Choose color...</option>
<option value="R">Red</option>
<option value="B">Blue</option>
</select>
required option for select tag

<!— This option cannot be select and this will be default option too. –>

<option selected=”true” disabled=”disabled”>Select a Option</option>

<!-- Here is a example : -->
<label for="payment">Choose a Type :</label>
<select name="payment" required>
<option selected="true" disabled="disabled">Select a Option</option>
<option value="recharge">Recharge</option>
<option value="withdraw">Withdraw</option>
</select>

 

 

Leave a Comment