BalajiB BalajiB - 1 year ago 82
Javascript Question

Auto Select the Multiselect 2's values based on Multiselect 1 values

In my view page, I have two multiselects named multiselect1, multiselect2 . In multiselect1, Iam fetching values from database and making them selected dynamically. Based on that, the values in Multiselect1 should be selected in multiselect2 automatically

<h4>First Multiselect</h4>
<select id='multipleSelect1' multiple='multiple' style="margin-right:40px">
<option value="1">One</option>
<option value="2">Two</option>
<option value="3">Three</option>

<h4> Second Multiselect </h4>

<select id='multipleSelect2' multiple='multiple'>
<option value="1">One</option>
<option value="2">Two</option>
<option value="3">Three</option>
<option value="4">Four</option>
<option value="5">Five</option>

JSFiddle Link :

Thank you

Answer Source

Simple enough..
Just remove the For loop..



OnChange Demo

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download