gfranko / jquery.selectBoxIt.js

A jQuery Select Box Plugin for Mobile, Tablet, and Desktop
http://www.selectboxit.com
MIT License
852 stars 301 forks source link

Cannot Prevent tabbing out of the SelectBox #275

Closed mburke1246 closed 10 years ago

mburke1246 commented 10 years ago

I have been trying to figure out a way to prevent the user from leaving the select box. We have done this already for the text fields but for some reason the select box is not preventing the tab key from being fired.

How can I prevent the user from tabbing out of the select box?

gfranko commented 10 years ago

Try using the special tab-blur event that SelectBoxIt triggers. Like this:

var selectBox = $("select").selectBoxIt();

selectBox.on('tab-blur', function(ev, obj) {
  setTimeout(function() {
    obj.dropdown.focus();
  }, 0);
});