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.
21,998
questions
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?
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">...
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.
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 ...
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 ...
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?
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&...
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&...
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
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>
</...
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 ...
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.
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 ...
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>
...
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 ...
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: ...
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 ...
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 ...
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 ...
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 ...
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 = "...
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="...
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?
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" ...
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 ...
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.
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>
...
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 ...
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</...
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"&...
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">
<...
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?
...
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 ...
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><...
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 ...
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"&...
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 ...
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 ...
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?
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 ...
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?
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 ...
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 ...
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"&...
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&...
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 ...
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 ...
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 ...
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 ...
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 ...