select2 search not working code example
Example 1: select2 in modal not work
//replace it with your script
<script>
$('#mySelect2').select2({
dropdownParent: $('#myModal')
});
</script>
Example 2: enforcefocus select2 modal
// Do this before you initialize any of your modals
$.fn.modal.Constructor.prototype.enforceFocus = function() {};
Example 3: select2 search not working
Just remove tabindex="-1" from the modal
<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">Panel</h3>
</div>
<div class="modal-body" style="max-height: 800px">
<div id="myModal" class="modal hide fade" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">Panel</h3>
</div>
<div class="modal-body" style="max-height: 800px">
Example 4: select2 search textbox not working
Remove tabindex = "-1" from the bootstrap modal