I am using select2 jquery function. To create a drop down with multiple selections. I am able to do it. Now I need to select a few options from the drop down list as default data. Can you help me?
data = [{id:1,text:"abc"},{id:2,text:"qwe"},{id:3,text:"def"}];
$("#test").select2({ theme: "bootstrap", data: dat });
// select option 2 as default selected I used below code
// but it is not working..
$("#test").select2("val", 2);