I am using select2 version 4.0, and I am trying to make a programmatic selection to a select box which gets its data from an ajax call.
In the documentation, I found how
It's easy to manipulate the hidden box as:
//set first option as selected $("select [value='0']").attr("selected","selected"); $("select").trigger("change");
Demo