Branches (select2):
<select id="branches" name="branches" multiple="multiple>
<options>
</select>
<script type="text/javascript">
$("#wgt-branches").select2({});
</script>
I want to limit the number of branches you can select according to the option selected here:
<select onchange="newLength(this)">
<option value=1>1</option>
<option value=2>2</option>
<option value=3>3</option>
</select>
this is what I tried and it didn't work:
<script>
function newLength(value){
var seleccion=$(value).val();
$("#wgt-branches").select2({maximumSelectionLength:seleccion});
}
</script>
thanks for your help.
B/R.