How can I create an editable dropdownlist in HTML?

前端 未结 11 1123
终归单人心
终归单人心 2020-11-29 01:51

I\'d like to create a text field with a dropdown list that lets the user choose some predefined values. The user should also be able to type a new value or select a predefin

11条回答
  •  感动是毒
    2020-11-29 02:20

    The best way to do this is probably to use a third party library.

    There's an implementation of what you're looking for in jQuery UI jQuery UI and in dojo dojo. jQuery is more popular, but dojo allows you to declaratively define widgets in HTML, which sounds more like what you're looking for.

    Which one you use will depend on your style, but both are developed for cross browser work, and both will be updated more often than copy and paste code.

提交回复
热议问题