Loading ...
Sorry, an error occurred while loading the content.

prevent list from displaying when clicked?

Expand Messages
  • Jack Bates
    I have a input with hundreds of items. When JavaScript is enabled, I d like clicking the input to instead display a hierarchical YUI menu. I
    Message 1 of 1 , Mar 3, 2008
    • 0 Attachment
      I have a <select> input with hundreds of items. When JavaScript is
      enabled, I'd like clicking the input to instead display a hierarchical
      YUI menu.

      I successfully created the hierarchical menu and attached an onclick
      handler to the select input. The onclick handler returns false, however
      clicking the input still displays both the select items and the YUI
      menu:

      <select name="foo" onclick="menu.show(); return false">

      I reported this behaviour as a bug:
      https://bugzilla.mozilla.org/show_bug.cgi?id=413374

      - but apparently the HTML I used to attach the onclick handler is
      invalid: <select> only support onfocus, onblur and onchange.

      Unfortunately I had no better luck with:

      <select name="foo" onfocus="menu.show(); return false"
      onblur="menu.hide(); return false">

      - clicking the input still displays both the select items and the YUI
      menu.

      Has anyone else had better luck preventing a select list from displaying
      when clicked?

      Much thanks, Jack
    Your message has been successfully submitted and would be delivered to recipients shortly.