Questions tagged [drop-down-menu]

A GUI element, similar to a combobox and a list box, which allows the user to choose one value from a list. When a drop-down list is inactive, it displays a single value. When activated, it displays (drops down) a list of values, from which the user may select one.

Filter by
Sorted by
Tagged with
2530 votes
35 answers
2.4m views

Get selected text from a drop-down list (select box) using jQuery

How can I get the selected text (not the selected value) from a drop-down list in jQuery?
haddar's user avatar
  • 25.5k
1413 votes
36 answers
2.3m views

jQuery Get Selected Option From Dropdown

Usually I use $("#id").val() to return the value of the selected option, but this time it doesn't work. The selected tag has the id aioConceptName html code <label for="name">...
William Kinaan's user avatar
1248 votes
43 answers
851k views

How to make Twitter Bootstrap menu dropdown on hover rather than click

I'd like to have my Bootstrap menu automatically drop down on hover, rather than having to click the menu title. I'd also like to lose the little arrows next to the menu titles.
falter's user avatar
  • 13.6k
532 votes
5 answers
337k views

How to add item to the beginning of List<T>?

I want to add a "Select One" option to a drop down list bound to a List<T>. Once I query for the List<T>, how do I add my initial Item, not part of the data source, as the FIRST element ...
Ash Machine's user avatar
  • 9,751
395 votes
40 answers
486k views

Avoid dropdown menu close on click inside

I have a Twitter Bootstrap dropdown menu. As all Twitter Bootstrap users know, the dropdown menu closes on click (even clicking inside it). To avoid this, I can easily attach a click event handler on ...
php-dev's user avatar
  • 7,078
383 votes
18 answers
871k views

How can I set the value of a DropDownList using jQuery?

As the question says, how do I set the value of a DropDownList control using jQuery?
flesh's user avatar
  • 23.9k
378 votes
16 answers
766k views

How to remove the default arrow icon from a dropdown list (select element)?

I want to remove the dropdown arrow from a HTML <select> element. For example: <select style="width:30px;-webkit-appearance: none;"> <option>2000</option> <option&...
user2301515's user avatar
  • 5,003
374 votes
24 answers
1.3m views

How to style the option of an HTML select element?

Here's my HTML: <select id="ddlProducts" name="ddProducts"> <option>Product1 : Electronics </option> <option>Product2 : Sports </option> </select&...
MrClan's user avatar
  • 6,602
304 votes
12 answers
482k views

How do I add options to a DropDownList using jQuery?

As the question says, how do I add a new option to a DropDownList using jQuery? Thanks
flesh's user avatar
  • 23.9k
277 votes
16 answers
648k views

Get selected option text with JavaScript

I have a dropdown list like this: <select id="box1"> <option value="98">dog</option> <option value="7122">cat</option> <option value="142">bird</option> </...
techtheatre's user avatar
  • 5,938
273 votes
11 answers
843k views

How to get multiple selected values of select box in php?

I have a html form which has a select list box from which you can select multiple values because its multiple property is set to multiple. Consider form method is 'GET'. The html code for the form is ...
Param-Ganak's user avatar
  • 5,847
272 votes
14 answers
740k views

How to create a drop-down list?

How can I create a drop-down list? I've tried a ScrollView but it's not exactly what I need.
user1820528's user avatar
  • 2,837
218 votes
8 answers
400k views

DropDownList's SelectedIndexChanged event not firing

I have a DropDownList object in my web page. When I click on it and select a different value, nothing happens, even though I have a function wired up to the SelectedIndexChanged event. First, the ...
gcode's user avatar
  • 2,979
177 votes
14 answers
458k views

How to use jQuery to select a dropdown option?

I was wondering if it’s possible to get jQuery to select an <option>, say the 4th item, in a dropdown box? <select> <option></option> <option></option> ...
dotty's user avatar
  • 41k
170 votes
26 answers
266k views

How can I close a dropdown on click outside?

I would like to close my login menu dropdown when the user click anywhere outside of that dropdown, and I'd like to do that with Angular2 and with the Angular2 "approach"... I have implemented a ...
Clement's user avatar
  • 3,970
155 votes
24 answers
451k views

How to implement drop down list in flutter?

I have a list of locations that i want to implement as a dropdown list in Flutter. Im pretty new to the language. Here's what i have done. new DropdownButton( value: _selectedLocation, onChanged: ...
Chaythanya Nair's user avatar
152 votes
9 answers
194k views

How can I remove the gloss on a select element in Safari on Mac?

On Macs and iOS devices, in Safari, a <select> element with a background color generates a gloss over itself. This does not seem to happen in other operating systems. For example, I have a ...
Ian Hunter's user avatar
  • 9,665
145 votes
4 answers
235k views

Android custom dropdown/popup menu

How do I do a custom dropdown/popup menu anchored to a button? I need it to work like the popup menu (anchored to a view), and do something when I click an item from the menu. How do I add items to ...
stanete's user avatar
  • 4,082
145 votes
9 answers
540k views

How to set a selected option of a dropdown list control using angular JS

I am using Angular JS and I need to set a selected option of a dropdown list control using angular JS. Forgive me if this is ridiculous but I am new with Angular JS Here is the dropdown list control ...
themhz's user avatar
  • 8,384
139 votes
20 answers
105k views

Firefox ignores option selected="selected"

If you change a dropdown and refresh the page, Firefox seems to ignore the selected attribute. <option selected="selected" value="Test">Test</option> It will in fact ...
monkey-wrench's user avatar
136 votes
10 answers
252k views

Asp.net - Add blank item at top of dropdownlist

Why is the dropdown not showing my blank item first? Here is what I have drpList.Items.Add(New ListItem("", "")) With drpList .DataSource = myController.GetList(userid) .DataTextField = "...
Saif Khan's user avatar
  • 18.6k
130 votes
8 answers
293k views

Bootstrap: Position of dropdown menu relative to navbar item

I have the following dropdown <label class="dropdown-toggle" role="button" data-toggle="dropdown" data-target="#"> Action <b class="caret"></b></label> <ul class="...
curious1's user avatar
  • 14.4k
130 votes
8 answers
188k views

Check if value is in select list with JQuery

How can I, using JQuery, check if a value belongs to dropdown list or not?
user271507's user avatar
  • 1,249
128 votes
33 answers
538k views

Bootstrap dropdown not working

I can't make bootstrap dropdown to work. Here is my html for nav: <ul class='nav'> <li class='active'>Home</li> <li class='dropdown'> <a class="dropdown-toggle" ...
hjuster's user avatar
  • 4,050
122 votes
2 answers
173k views

How to check if an object is a certain type

I am passing various objects to a subroutine to run the same process but using a different object each time. For example, in one case I am using a ListView and in another case I am passing a ...
Leah's user avatar
  • 2,567
119 votes
10 answers
184k views

How do I check how many options there are in a dropdown menu?

How do I check, using jQuery, how many options are there in a drop down menu? Thanks.
Asim Zaidi's user avatar
  • 27.7k
115 votes
8 answers
199k views

Blank HTML SELECT without blank item in dropdown list

How implement subj? when i write: <form> <select> <option value="0">aaaa</option> <option value="1">bbbb</option> </select> </form> ...
Nick Stavrogin's user avatar
114 votes
4 answers
127k views

C# DropDownList with a Dictionary as DataSource

I want to set DataTextField and DataValueField of a Dropdownlist (languageList) using a Dictionary (list) of languageCod (en-gb) as key and language name (english) as the text to display. Relevant ...
VansFannel's user avatar
  • 45.5k
109 votes
13 answers
400k views

Change Select List Option background colour on hover

Is it possible to change the default background color of a select list option on hover? option:hover { background-color: red; } <select id="select"> <option value="1">One</...
Gopesh's user avatar
  • 3,952
106 votes
14 answers
457k views

How to get selected value of a dropdown menu in ReactJS

I'm using react and I want to get the value of the selected option of a dropdown in react but I don't know how. Any suggestions? thanks! My dropdown is just a select like: <select id = "dropdown"&...
BlueElixir's user avatar
  • 3,369
102 votes
9 answers
240k views

How to add Drop-Down list (<select>) programmatically?

I want to create a function in order to programmatically add some elements on a page. Lets say I want to add a drop-down list with four options: <select name="drop1" id="Select1"> <...
Christos Baziotis's user avatar
96 votes
10 answers
212k views

How to select/get drop down option in Selenium 2

I am converting my selenium 1 code to selenium 2 and can't find any easy way to select a label in a drop down menu or get the selected value of a drop down. Do you know how to do that in Selenium 2? ...
user786045's user avatar
  • 2,538
95 votes
19 answers
214k views

Adding a slide effect to bootstrap dropdown

I'm using bootstrap, and I'd like to add animation to a dropdown. I want to add an animation to it, slide down and back up when leaving it. How could I do this? Things I tried: Changing the Js drop ...
Ben Beri's user avatar
  • 1,151
94 votes
11 answers
227k views

set dropdown value by text using jquery [duplicate]

I have a dropdown as: <select id="HowYouKnow" > <option value="1">FRIEND</option> <option value="2">GOOGLE</option> <option value="3">AGENT</option><...
Prasad's user avatar
  • 59.2k
92 votes
27 answers
101k views

Dropdownlist width in IE

In IE, the dropdown-list takes the same width as the dropbox (I hope I am making sense) whereas in Firefox the dropdown-list's width varies according to the content. This basically means that I have ...
Nimesh Madhavan's user avatar
90 votes
11 answers
309k views

Enable/Disable a dropdownbox in jquery

I am new to jQuery and I want to enable and disable a dropdown list using a checkbox. This is my html: <select id="dropdown" style="width:200px"> <option value="feedback" name="aft_qst"&...
ARUN P.S's user avatar
  • 1,713
90 votes
14 answers
170k views

Can I open a dropdownlist using jQuery

For this dropdownlist in HTML: <select id="countries"> <option value="1">Country</option> </select> I would like to open the list (the same as left-clicking on it). Is this ...
Jon Tackabury's user avatar
89 votes
8 answers
351k views

Percentage calculation

I am working in progress bar concept in ASP.NET MVC 2. Here i have a DropDownList which has 10 values. i want to calculate the percentage for progress bar, e.g. 10 values from DropDownList and i am ...
RobinHood's user avatar
  • 2,377
87 votes
3 answers
73k views

How do I set the HTML options for collection_select in Rails?

I can't seem to find the syntax to add a class to a select tag generated by Rails collection_select. Some help?
tybro0103's user avatar
  • 49.1k
87 votes
10 answers
155k views

There is no ViewData item of type 'IEnumerable<SelectListItem>' that has the key 'xxx'

There are a couple of posts about this on Stack Overflow but none with an answer that seem to fix the problem in my current situation. I have a page with a table in it, each row has a number of text ...
Jimbo's user avatar
  • 22.7k
86 votes
13 answers
233k views

How to make a drop down list in yii2?

How to make a dropdown in yii2 using an activeform and a model? Since all the methods has changed in yii2,how it is done in the new one?
Dency G B's user avatar
  • 8,136
85 votes
9 answers
218k views

How to have a drop down <select> field in a rails form?

I am creating a scaffold - rails g scaffold Contact email:string email_provider:string but I want the email provider to be a drop down (with gmail/yahoo/msn as options) and not a text field. How ...
iCyborg's user avatar
  • 4,708
84 votes
4 answers
163k views

CSS position absolute and width of parent container in percent

I'm trying to build a HTML/CSS dropdown menu which is flexible in width. Due to the position:absolute for the second level of the navigation, I don't get the width of the first level. Removing the ...
chris's user avatar
  • 2,181
82 votes
7 answers
604k views

How can change width of dropdown list?

I have a listbox and I want to decrease its width. Here is my code: <select name="wgtmsr" id="wgtmsr" style="width: 50px;"> <option value="kg">Kg</option> <option value="gm"&...
user1844626's user avatar
  • 1,848
80 votes
7 answers
60k views

Aligning text and select boxes to the same width in CSS?

Ok this is seemingly impossible to get right. I have a text box and a select box. I want them to be the same width exactly so they line up on the left margin and the right margin. <!DOCTYPE html&...
zuallauz's user avatar
  • 4,318
79 votes
7 answers
198k views

jQuery to remove an option from drop down list, given option's text/value

I have a drop down list and would like to remove an option from it, given the text/value of that particular option. Is it possible using jQuery? Just like 'append' which adds an option to the drop ...
Arnkrishn's user avatar
  • 30.1k
77 votes
24 answers
86k views

Flutter: There should be exactly one item with [DropdownButton]'s value

I am trying to create a dropdown button in Flutter. I am getting a List from my database then I pass the list to my dropdownButton everything works the data is shown as intended but when I choose an ...
Abdelbaki Boukerche's user avatar
77 votes
9 answers
84k views

Bootstrap dropdown closing when clicked

I put a form inside a bootstrap dropdown, but when I click any of the fields in the form, the dropdown goes away. I have this piece of code but I don't know where to put it to prevent the dropdown ...
Sorin Cioban's user avatar
  • 2,235
76 votes
10 answers
306k views

Change color and appearance of drop down arrow

I want to change the default appearance of the arrow of a dropdown list so that looks the same across browsers. Is there a way to override the default look and feel of the drop down arrow using CSS or ...
Iris's user avatar
  • 1,331
75 votes
12 answers
311k views

Setting dropdownlist selecteditem programmatically

I want to set the selecteditem attribute for an ASP.Net dropdownlist control programmatically. So I want to pass a value to the dropdownlist control to set the selected item where the item is equal ...
Eyla's user avatar
  • 5,771

1
2 3 4 5
440