jquery - select2 force focus on page load -


i trying make select2 box appear in focused state on page load. have tried following:

$('#id').select2('focus'); $('#id').trigger('click'); $('#id').trigger('focus'); 

only first line seems have effect, , focus select2 field, requires additional keypress display search field, , allow typing in search string.

therefore, if load page , start typing: "search", "s" open search box , remainder of keys entered it, you'll searching "earch"

according select2 documentation:

$('#id').select2('open'); 

should need.

found under programmatic access section in documentation.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -