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
Post a Comment