chosen-ajax-addition icon indicating copy to clipboard operation
chosen-ajax-addition copied to clipboard

focus and events implement

Open fitorec opened this issue 11 years ago • 2 comments

:neckbeard:Hi!

Would be great to be able to observe the events of the element and implement the 'focus' event something like:

 $('#states-select').ajaxChosen({
    //params
  });
  //more code..
 $('#states-select').focus();

or maybe like the modal of twBootstrap:

 $('#states-select').ajaxChosen({
    //params
  });
  //more code..
  $('#states-select').ajaxChosen('focus');

i don't know :confused: is a simple idea, what is your opinion?

fitorec avatar Mar 01 '14 00:03 fitorec

For me it looks like feature of Chosen plugin not ajaxChosen extension. What do you think @ksykulev ?

lcmen avatar Mar 03 '14 15:03 lcmen

I would probably put that feature on the chosen plugin as well. But in the mean time if you need to programmatically focus on the input box and have chosen open you can do something like this:

chosen = $('#some-select').ajaxChosen({..}).next();
chosen.trigger('click'); //use this to open/focus on chosen.

I do this in the specs if you need a better example.

ksykulev avatar Mar 03 '14 16:03 ksykulev