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

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

ruby - Train neural network with sine function -

javascript - Java with RWeka packege -