A slight deviation of the answer
blushrt if you donβt have hardcoded values ββfor parameters (for example, 1, 2, 3, 4, etc.)
Say you render a <select> with parameter values ββthat are GUIDs for some users. Then you need to somehow extract the parameter value to set it to <select> .
Next, we select the first option.
HTML
<select name="selValue" class="selectpicker"> <option value="CD23E546-9BD8-40FD-BD9A-3E2CBAD81A39">Dennis</option> <option value="4DDCC643-0DE2-4B78-8393-33A716E3AFF4">Robert</option> <option value="D3017807-86E2-4E56-9F28-961202FFF095">George</option> <option value="991C2782-971E-41F8-B532-32E005F6A349">Ivanhoe</option> </select>
Javascript
We used this in select with the multiple keyword <select multiple> . In this case, nothing is selected by default, but we wanted the first item to always be selected.
Kristian Vinther Apr 29 '15 at 18:25 2015-04-29 18:25
source share