javascript - Set the default value of a dropdown which is populated dynamically using Java script -


i see lot of dropdowns defined @ multiple locations in jsp. this: (with different ids).

 <select class="school-names" name="schoolname" id="aaschoolname" >     </select> 

these dropdowns populated below:

 <c:foreach items="${schools}" var="sc">     var scname = "${sc.schoolname}";      jquery('.school-names').append('<option value="' + scname + '">' + scname +   '</option>');  </c:foreach> 

this dropdown populated on load of jsp page. how set default value of each dropdown onload of jsp page.


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -