Women in Technology

Hear us Roar



Article:
  Cooking with JavaScript & DHTML
Subject:   Select Type-Ahead
Date:   2004-04-08 15:33:13
From:   vhb
Great piece of code, I've been looking for this kind of functionality for some time. I notice that if the dropdown is open then the typed slection does stick if you Tab off the control. Is there anyway to fix that? Thanks.
Full Threads Newest First

Showing messages 1 through 2 of 2.

  • Select Type-Ahead
    2004-04-08 15:36:32  vhb [View]

    Correction, the typed selection DOES NOT stick if the dropdown is open and you Tab off the control.
    • Select Type-Ahead
      2004-04-19 23:10:01  Danny Goodman | O'Reilly Author [View]

      You need to add one line of code that short-circuits the Tab character. After the line in the typeAhead() function that reads var charCode = evt.keyCode;, add the following line:

      if (charCode == 9) { return true; }

      That appears to do the trick.