Drop Down Menu/Text Field in one

后端 未结 8 747
遇见更好的自我
遇见更好的自我 2020-12-07 13:22

I\'m working on building new site, and I need a drop down menu to select the amount of something in my site. But at the same time I need this drop down list to accept text.

相关标签:
8条回答
  • 2020-12-07 13:53

    The modern solution is an input field of type "search"!

    https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/search https://www.w3schools.com/tags/tag_datalist.asp

    Somewhere in your HTML you define a datalist for later reference:

    <datalist id="mylist">
       <option value="Option 1">
       <option value="Option 2">
       <option value="Option 3">
    </datalist>
    

    Then you can define your search input like this:

    <input type="search" list="mylist">
    

    Voilà. Very nice and easy.

    0 讨论(0)
  • 2020-12-07 13:54

    I like jQuery Token input. Actually prefer the UI over some of the other options mentioned above.

    http://loopj.com/jquery-tokeninput/

    Also see: http://railscasts.com/episodes/258-token-fields for an explanation

    0 讨论(0)
提交回复
热议问题