Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Add one selected data
- $("#field").select2('data', { 'id' : value, 'text' : text});
- // Add multiple selected element
- var data = {
- 'id' : value1, 'text' : text1,
- 'id' : value2, 'text' : text2,
- ...
- 'id' : valueN, 'text' : textN,
- };
- $("#field").select2('data', data);
Add Comment
Please, Sign In to add comment