I have a button:
<button>
Small car
</button>
When clicked it should set the option of a dropdown to "Small car".
<select>
<option value="smallcar">Lille personbil</option>
<option value="mediumcar">Lille varevogn</option>
<option value="largecar">Mellem varevogn</option>
</select>
It seems simple, but I have no clue.
If you want to change the selected value of a select>, You need to write a JavaScript script.
To change the selected value of a select> in JavaScript:
document.getElementById('selectId').value= 0;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.