2

I can't seem to find this anywhere. Is there a way to select the full display text of the combobox when the user clicks in the combobox to filer? By default, when the user clicks into the combobox, the the user has to manually select the full text and delete. I would like to select the text for them so all they would have to do is hit the delete button to remove it.

Pritesh
  • 41
  • 2
  • 8

1 Answers1

2

You can do this by adding a focus-event in the underlying Textbox of the Autocomplete-Control.

See this jsFiddle for a demo: Click Me

Code:

$('input').focus(function(e) {
    $(this).select();
});
Shion
  • 1,499
  • 2
  • 14
  • 29
  • Thanks. I had a brain fart and then remembered at night that i could just do the .select on the onFocus event. – Pritesh Apr 11 '13 at 15:05
  • You know there is one thing I noticed about comboboxes. When you click in the comobobox, the cursor is moved to the end of the text which causes the selection to disappear. Is there a way to prevent that? – Pritesh Apr 11 '13 at 18:42
  • Sorry, that I don't know. Open up a new question for this ;) – Shion Apr 12 '13 at 09:03
  • 2
    i figured it out. I just added a mouseup event and prevented the default and stopped the propagation. That prevented the cursor to be placed at that end. – Pritesh Apr 12 '13 at 17:10