ivaynberg/select2 — pull request #2702 by dgroux (2014-09-26 13:32:07+00:00)
Title: allow formatSelection to return a jQuery object

https://github.com/ivaynberg/select2/issues/2393

Currently only strings can be returned from the formatSelection function. Greater flexibility can be provided with the ability to return a jQuery object.

i.e.

```javascript
formatSelection: function(state) {
return $('

Click me

').click(function() { alert('clicked'); });
}
```

Here is an example of creating an instance of select2 inside another:

![select2_template](https://cloud.githubusercontent.com/assets/4863750/4421020/be56516c-457f-11e4-95a0-5959d1691744.png)