How do I Change the Values in an HTML Drop Box?
A drop-down box is a handy means of allowing your Web users to make a choice. The choice may be a color or size for an item to be purchased from your site. It may cause an immediate action to be performed on your Web page. Perhaps you have inherited HTML code that contains a drop-down box and need to change the existing values. Consider the following example.
Instructions
-
-
1
Open the HTML file and locate the drop-down box. It will look something like the following:
<FORM NAME="my_form">
<select name="itemcolor" id="colorid">
<option value="Purple">Purple</option>
<option value="Yellow">Yellow</option>
<option value="Red">Red</option>
</select>
</FORM>
This drop-down box presents the color choices purple, yellow and green. When the buyer clicks on the color "Yellow," for instance, the form sends back the "value" attribute of "Yellow."
-
2
Change the "Purple" value to "Blue" as follows: Locate the text "Purple" between the <option> tags. This is the text visible to the user in the drop-down box. Change "Purple" to "Blue." Change the "value" attribute from "Purple" to "Blue" or any value that you like that will let you know your user has chosen blue.
-
-
3
Save the file and test by clicking on your HTML file.
-
1
References
- Photo Credit Highlighters image by chas53 from Fotolia.com