I had this working at some point, as I had a question about this in the past that helped me, but now I lost the code, so I went back to my question and tried to get it working, and now it isn’t…
Please someone help me as to why this isn’t working anymore?
CODE
var valArr = [3, 4];
size = valArr.length;
for (i = 0; i < size; i++) {
$("#secondary_group option[value='" + valArr[i] + "']").
attr("selected", 1);
$("#secondary_group").multiselect("refresh");
}
Demo: http://jsfiddle.net/VXbLE/
What it’s supposed to do, is select the option based on it’s value, basically, you can read the code from the jsfiddle and figure that out.
I am a beginner in JavaScript/jQuery so I don’t understand it completely…
DEMO