0

I've go a multiselect:

<select id="select1" multiple>
  <option value="1">1</option>
  <option value="2">2</option>
  <option value="3">3</option>
  <option value="4">4</option>
  <option value="5">5</option>
</select>

and javascript object:

{
 0: {id: 1, name: test1}
 1: {id: 3, name: test3}
 2: {id: 5, name: test5}
}

How to make options "selected" and change value of select using ids from javascript array?

Maybe there is some simple JS function for that? I coded that: but this was a big bunch of code...maybe somebody knows how to do it simple way?

Mario Bash
  • 39
  • 8

0 Answers0