--- title: Dropdown taxonomy: category: docs process: twig: true never_cache_twig: true --- This chapter covers the appearance and behavior of the list of results in the dropdown menu. ## Templating By default, Select2 will display the `text` property of each data object within the list of results. The appearance of search results in the dropdown can be customized by using the `templateResult` option:
false
), the dropdown will not automatically close when a result is selected. The dropdown will also never close if the ctrl key is held down when the result is selected.
## Dropdown placement
>>>>> Attention [Harvest Chosen](https://harvesthq.github.io/chosen/) migrators! If you are migrating to Select2 from Chosen, this option will cause Select2 to position the dropdown in a similar way.
By default, Select2 will attach the dropdown to the end of the body and will absolutely position it to appear above or below the selection container.
Select2 will display the dropdown above the container if there is not enough space below the container, but there is enough space above it.
The `dropdownParent` option allows you to pick an alternative element for the dropdown to be appended to:
```
$('#mySelect2').select2({
dropdownParent: $('#myModal')
});
```
This is useful when attempting to render Select2 correctly inside of modals and other small containers. If you're having trouble using the search box inside a Bootstrap modal, for example, trying setting the `dropdownParent` option to the modal element.
If you are rendering a Select2 inside of a modal (Bootstrap 3.x) that has not yet been rendered or opened, you may need to bind to the `shown.bs.modal` event:
```
$('body').on('shown.bs.modal', '.modal', function() {
$(this).find('select').each(function() {
var dropdownParent = $(document.body);
if ($(this).parents('.modal.in:first').length !== 0)
dropdownParent = $(this).parents('.modal.in:first');
$(this).select2({
dropdownParent: dropdownParent
// ...
});
});
});
```
If you run into positioning issues while using the default `body` attachment, you may find it helpful to use your browser console to inspect the values of:
- `document.body.style.position`
- `$(document.body).offset()`
See [this issue](https://github.com/select2/select2/issues/3970#issuecomment-160496724).
>>>> `dropdownParent` will cause DOM events to be raised outside of the standard Select2 DOM container. This can cause issues with third-party components such as modals.