'Select element through jQuery in sumo select plugin not working

I am trying to select a value in sumoselect dropdown through jQuery using:

 $('select.multiple-select2')[0].sumo.selectItem(2);

Its not getting select.

Sumoselect - https://hemantnegi.github.io/jquery.sumoselect/

Please help me.



Solution 1:[1]

You need to use selectItem method as follows:

$('select.multiple-select2')[0].sumo.selectItem(2);

Have a look at documentation at https://hemantnegi.github.io/jquery.sumoselect/

There is no any method like setItem which you are trying.

Solution 2:[2]

Try This.

 $('#_dropdownID')[0].sumo.selectItem(data[0].stringValue);

This is to get the data from SQL and matching with the dropdown options. it comes as this

success:function(data){
 $('#_dropdownID')[0].sumo.selectItem(data[0].stringValue);
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 vijayP
Solution 2 Roshan Zaid