There can be many parameters in the SELECT drop-down list.
<select id="sel"> <option value="car">1</option> <option value="bike">2</option> <option value="cycle">3</option> ... </select>
I am creating an update profile page in which a user profile is retrieved from the database and the form is displayed with these values. When it comes to the SELECT dropdown, there are many options. So, his tedious test for all values
if (value == '1') echo "<option selected value='car'>1</option>";`
So, I want the appropriate option to be selected from its value. For example, when I do something like sel.value = 'bike' using JavaScript, select option 2 .
javascript html html-select
Dilip Raj Baral Sep 04 2018-12-12T00: 00Z
source share