html-select

How to adjust Select drop-down height [duplicate]

萝らか妹 提交于 2019-12-04 04:42:30
This question already has answers here : Closed 4 years ago . Height of an HTML select box (dropdown) (6 answers) I've looking round the internet for a solution to this and everyone is talking about different things or just saying does size="x" help ? I've made a Plunk to illustrate my issue. On my screen I can see up to item 20 when I click the drop down. I'd like to be able to set this to show more, or at least have some control. http://plnkr.co/edit/gsFK5NmHKo4xopYBruD6?p=preview Gabriele Petrioli You cannot because the select box is a system control.. See Height of an HTML select box

how to find the latest selected item of a multiple select tag using jquery?

╄→гoц情女王★ 提交于 2019-12-04 04:40:11
问题 I have a <select multiple="multiple" id="multi"> in my website, and I have a script in jquery that has this function: $("#multi").on("change",function(){}) I want to access the latest selected item of the select in this function(the last one selected by user), how can I do that? 回答1: To get the last selected by the user, you can do this var map = $("#multi").on("change",function(){ var comp = $("#multi option:selected").map(function() { return this.value; }).get(), set1 = map.filter(function

Simple html select not working on android chrome

社会主义新天地 提交于 2019-12-04 04:32:29
I'm having trouble with google chrome for android. My select tag in html doesn't work there, but it works on desktop google chrome and other browsers, even in safari and apple mobile devices, just not in google chrome for android. I've tried other apps that have normal selects and they seem to work in mobile google chrome. Here's an example of what's happening: I have no idea how to fix this issue. If anyone could give me hints on what could be the reason. This is the select: <select class="form-control" name="cardType" ng-model="payment.cardType" required> <option value="AMEX">AMEX</option>

Using Selenium for selecting an option on a select with optgroup

拥有回忆 提交于 2019-12-04 03:59:07
I'm trying to select a value in a select element. I'm using Selenium RC (Java) to run the test cases. I understand that the code for selecting a value is given by: selenium.select("locator", "value=REQUIRED VALUE") I'm unable to select the desired value with the above code. I think it might be something to do with optgroup in the select source code. I do not get any exceptions, the command executes fine but looking at the page the required value is not selected. Also, I cant use ids (instead of value) because there arent any. Here is the source code of the selector: <select> <optgroup label=

Select dropdown menu text split left and right?

我与影子孤独终老i 提交于 2019-12-04 03:40:54
问题 Not sure if this can be done but can I split the text in the option tags? Example, normal styling: <select> <option value="">First - A</option> <option value="">Car - B</option> <option value="">Black - C</option> <option value="">Super Duper - D</option> </select> How can I get it to look like this: <select> <option value="">First - A</option> <option value="">Car - B</option> <option value="">Black - C</option> <option value="">Super Duper - D</option> </select> I've tried added a span tag

Dropdown currentIndex onchange

旧城冷巷雨未停 提交于 2019-12-04 03:37:01
there is a dropdown with 5 options. Currently,option 2 is selected.The user selects option 4 now.The onchange event gets fired which is caught in a JS function listening for onchange on the select. In the JS function, I can check easily the index of the option selected by the user using the selectedIndex property.However, I want to also know what was the original value that the user changed it from. Is there a property that persists basically the original value i.e. option 2 in this case. Just as a concept I put together the following - there may very well be a better way to do this: var vals

How to Hide and Show SELECT Options with JQuery in IE

断了今生、忘了曾经 提交于 2019-12-04 03:05:30
问题 I'm trying to hide some options from a drop down. JQuery's .hide() and .show() work great in Firefox and Chrome, but no luck in IE. Any good ideas? 回答1: Of many possible approaches, this method requires browser sniffing (which in general is not great) but doesn't require having multiple copies of the same select list to swap in and out. //To hide elements $("select option").each(function(index, val){ if ($(this).is('option') && (!$(this).parent().is('span'))) $(this).wrap((navigator.appName =

AngularJs and <select>: Default selected options are removed

♀尐吖头ヾ 提交于 2019-12-04 00:08:57
I expect the following code to render a drop down list with the third option selected by default. However, when I bind the select with angularjs, the default selection disappears. Any thought? var myApp = angular.module('myApp', []); ... <div> <select id="myselection" ng-model="selectedColors"> <option value="1" >Red</option> <option value="2">Blue</option> <option value="3" selected="selected">Green</option> </select> <div> Selected Colors: {{selectedColors }} </div> </div> Here's a working example: http://jsfiddle.net/TXPJZ/134/ Thanks! The easiest way to fix your implementation is to use ng

Best practice for HTML <option> : selected VS selected=“selected”

穿精又带淫゛_ 提交于 2019-12-03 23:35:21
What is the best practice to pre-select an <option> in a <select> ? According to different websites, both works. But which one is better? the most compatible? <option selected="selected">Foo</option> <option selected>Bar</option> If you are writing XHTML, selected="selected" is required. If you are writing HTML, selected is fewer keystrokes and fewer bytes. Neither has better compatibility with browsers. According to the HTML4 standard , using selected implies it is selected="selected" . So the standard already defines both are supported. Their code sample already includes a code block just

How to POST empty <select .. multiple> HTML elements if empty?

早过忘川 提交于 2019-12-03 22:55:07
I have the following multi-select box in a HTML form, where user can select one or more option. <select id="eng_0" name="eng_0[]" multiple size="3"> <option value="Privilégier">Privilégier</option> <option value="Accepté">Accepté</option> <option value="Temporaire">Temporaire</option> </select> When the user selects no option, the form is POSTed to a PHP backend but it creates no empty array value for $_POST['eng_0'] as if the field was not even on the form. This is kind of like the unchecked checkbox that is not submitted problem. Is there any way to have it POST the select object even if