开发者

Is there any difference between drop down box and combo box?

Is there any d开发者_运维百科ifference between drop down box and combo box [ HTML ]?

Actually the point is, everytime i say something like: "there is some problem with the combo box", my senior says: "that's not a combo box that is a drop down", :)


Technically, there are no combo boxes in HTML, because the <SELECT> can't be typed into. See the Wikipedia article on Combo Box (emphasis mine):

A combo box is a commonly-used graphical user interface widget. It is a combination of a drop-down list or list box and a single-line textbox, allowing the user to either type a value directly into the control or choose from the list of existing options.

While the definition of drop-down list matches exactly what the HTML <SELECT> element does:

When activated, it displays (drops down) a list of values, from which the user may select one.

So your senior is right.


I guess he is getting at the fact

  • a combo box is a combination of an input text field and a list of options. You can type in stuff in the input field and the list should update to highlight a possible match
  • a dropdown is just a list of options that drops down when you click on the arrow button. You can only choose from a list of predefined options


The combobox allows the user to pick a value from a predefined set or input a custom one. The dropdownlist only allows picking one of the predefined values.


A combo box should have more than one item on a predefined list always visible to the user and should either:

enable users to select a single item from the predefined list and/or type their own value;

or

enable users to select multiple items from a displayed predefined list and/or add their own value

A drop-down/drop-list box should only display and enable users to select one item from a predefined list.


If you are considering which one to implement, I found the ARIA doc explains the trade-offs well:

When constructing a widget that is both visually compact and enables users to choose one value from a set of discrete values, often either a listbox or menu button is simpler to implement and use. One feature of combobox that distinguishes it from both listbox and menu button is that the value of the combobox is presented in an edit field. Thus, the combobox gives users one function that both listbox and menu button lack, namely the ability to select some or all of the value for copying to the clipboard. One feature that distinguishes both combobox and menu button widgets from listbox widgets is their ability to provide an undo mechanism.

To sum it up:

  • Prefer menu or listbox over combo box because they are simpler to implement
  • The only thing that differentiates combo box from the other two is it can enable users to copy to clipboard and undo


Combobox already selected one value. And additional Combobox combination of the input field.

Dropdown is a simple list item , and After selecting the value perform any task.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜