java - How to transfer an <option> tag's element into an array in javascript? -


how should options inside dropdown list (under html) , convert array in javasctipt? code snippet comes jsp/ html. form.projectlist java object call

<c:foreach items="${form.projectlist}" var="val">    <option ${form.project eq val.projectid?'selected="selected"':''}             value="<c:out value="${val.projectid}"/>"><c:out value="${val.project}"/></option> </c:foreach> 

use id of select , jquery populate array. following

var arr=new array(); $("#dropdwonid option").each(function() {     arr.push($(this).text()); }); 

Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -