javascript - Bootstrap Modal with Select2 Focus issue -


i have select2 selects on bootstrap 3 modal.

for 3 components code follows

   $('#primarymodal').on('shown.bs.modal', function () {              $(".icdlookup").select2({                .../              }): }; 

the problem have having in picture below. if make selection on select2 , focus out input focus still remain on select2 box.

enter image  here

i've solved problem applying following fix (just put in js code):

//fix modal force focus $.fn.modal.constructor.prototype.enforcefocus = function () {   var = this;   $(document).on('focusin.modal', function (e) {      if ($(e.target).hasclass('select2-input')) {         return true;      }       if (that.$element[0] !== e.target && !that.$element.has(e.target).length) {         that.$element.focus();      }   }); }; 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -