I have a select with 4 options. These 4 options are the number of options that will appear in a multiple select.
WhatIwantisassoonastheuserselectsthemostfrequentwordquantityoption,javascriptalreadyfillsthesecondselect
withthenumberofwordsselectedinthefirstselect
.Forthis,thebiggestoptionthattheusercanputis20andthecodebehind(injava)hasalistwiththe20mostfrequentwords.Thatis,Ineedafunctioninjavascriptthattakesthevalueselectedinthefirstselect
(X)andloadsthesecondselect
withthefirstXelementsofthelist(injava).
Forittoappearinselect
,thecodelookslikethis:
<selectname="vet[]" size="4" multiple><%
for(int i=0;i<5;i++){ %> <option> <% out.print(documento.vetor[i]); %> </option><% } %>
</select> <br>
In the case, the for is size 5 by default, but it is this number that I wish to change ..