java - How to Auto Select all different Option in Similar many's Drop-Down boxes in JSP -
please see image view want do...
<% for(;iteratoroflist.hasnext();) { string optionvalue = iteratoroflist.next(); %> <select id='1'> <option value="aunt">aunt</option> <option value="brother">brother</option> <option value="brother in law">brother in law</option> <option value="cousin">cousin</option> <option value="doughter">doughter</option> </select> <%}%>
in above code suppose loop runs 3 times , hence got 3 select boxes question how can select options in 3 select box have fetched info base of operations , 3 values have binded in request object select 3 differnt values in these select....
i quite did not understand question..but tried best..
you want populate drop downwards list list of strings.
i using jquery
this. 1 time have array of strings in javascript
iterate through array , create <option>
elements array values , append select
box.
$.each(relationslist, function(val, text) { $('#relationsdropdown').append( $('<option></option>').val(val).html(text) ); });
according updated question.. made changes , here jsfiddle
java javascript html jsp select
No comments:
Post a Comment