In this example of data loaded from a remote source I can see images and other html elements rendered as options. I\'d like to accomplish the same thing using data in a loc
If I am not mistaken you can only render HTML if you set the templateResult and templateSelection options and have them return a jQuery object.
var data = [
{ id: 0, text: 'enhancement' },
{ id: 1, text: 'bugThis is some small text on a new line' }];
$("select").select2({
data: data,
templateResult: function (d) { return $(d.text); },
templateSelection: function (d) { return $(d.text); },
})