Open dropdown on focus ?

1,984 views
Skip to first unread message

oxe...@gmail.com

unread,
Nov 12, 2013, 10:11:14 PM11/12/13
to sel...@googlegroups.com
Hello.

I was wondering if there was a way to have select2 dropdowns automatically open when they are focused?

I have tried the following:

$("#my_select").on("select2-focus", function(e) {
$(this).select2('open');
});

This doesn't really work because when I select an element, it re-focuses the same dropdown and re-opens itself.

I looked at the available options and found openOnEnter, but that does not do what I need, if there was one that would be 'openOnFocus' that would probably be helpful in a few cases (maybe be set to false by default?)

There must be another way to do it manually though, I'm not sure how it would be achieved right now, though.

Thanks for this plugin, it really is a great addition to a lot of my projects

oxe...@gmail.com

unread,
Feb 13, 2014, 11:01:31 PM2/13/14
to sel...@googlegroups.com, oxe...@gmail.com
Anyone with an idea on this?

To better describe the issue:

I have 5-6 select2 dropdowns in my page

1. The user clicks on the first one, select a value
2. The user pressed TAB
3. The user wants the next select 2 dropdown to be automatically focused and opened

Is there a way to do this?

Thanks

oxe...@gmail.com

unread,
Feb 15, 2014, 8:27:26 PM2/15/14
to sel...@googlegroups.com, oxe...@gmail.com
Reply all
Reply to author
Forward
0 new messages