html-select

Order of selection in html select multiple?

一笑奈何 提交于 2019-12-23 19:47:46
问题 I have a tagging plugin which maintains it's selection of tags in two forms. One is an internal array. The other is by having an html select which only contains the tags with all selected which allows the tagging plugin to act like a normal element if the plugin is part of a form. I have been asked to implement re-ordering. I know how to do this and adjust the array. The select has me a bit puzzled as to how different browsers handle the order. In what order are the selected items submitted

AngularJS select doesn't error when model value not in options

安稳与你 提交于 2019-12-23 17:27:49
问题 Angular 1.4.8. I have this markup for 2-letter US state codes: <div class="form-group" ng-class="{'has-error': form.licenseState.$invalid }"> <label for="licenseState" class="control-label">License State</label> <select name="licenseState" id="licenseState" class="form-control" required ng-model="ctrl.student.License.State" ng-options="key as key for (key, value) in ctrl.licenseFormats"> </select> </div> This properly gives me an error when the model value is loaded as blank. However, when

Selecting options in a select via JQuery

若如初见. 提交于 2019-12-23 17:13:42
问题 I have a select with the following options: <select> <option value="1">A</option> <option value="2">B</option> <option value="3">C</option> </select> I don't know what the values are, but in my JQuery code, I want to select option two because I know that the text is B (but nothing else). How can it be done? 回答1: You can use the :contains() selector: $('option:contains("B")').prop('selected', true); Alternatively: $('option') .filter(function() { return this.text == 'B'; }) .prop('selected',

Trying to open SELECT tag in Android WebView crashes the application

懵懂的女人 提交于 2019-12-23 10:24:25
问题 A similar question was asked about a year ago, and wasn't quite resolved, but I'm gonna try my luck anyhow, maybe someone knows this. I have this application that runs a couple of HTML pages in a WebView. Everything looks nice and works OK, until you try to open a SELECT tag - boom, application crashes. Here's a trace stack, if this helps: Thread [<1> main] (Suspended (exception WindowManager$BadTokenException)) AlertDialog(Dialog).show() line: 247 WebView$InvokeListBox.run() line: 7841

How to prevent same selected values in multiple drop down lists in a table & POST to server

纵然是瞬间 提交于 2019-12-23 06:04:46
问题 Example : imagine a table of babies , with each row users selects baby GenderDropDown , then Selects a name. I need to prevent duplicate name selection across the table, If user select Male & John, he cannot select that again in another row. Except babies, My table has rows that contain Projects, and BillCodes as DropDowns . If disable an select option in dropdown, then it does not POST to server! $('.timecodeDdlId').find('option[value=' + $(this).val() + ']').prop('disabled', true); works

How to prevent same selected values in multiple drop down lists in a table & POST to server

萝らか妹 提交于 2019-12-23 06:01:09
问题 Example : imagine a table of babies , with each row users selects baby GenderDropDown , then Selects a name. I need to prevent duplicate name selection across the table, If user select Male & John, he cannot select that again in another row. Except babies, My table has rows that contain Projects, and BillCodes as DropDowns . If disable an select option in dropdown, then it does not POST to server! $('.timecodeDdlId').find('option[value=' + $(this).val() + ']').prop('disabled', true); works

Copy JSON Object of One Select to another Select ng-model using AngularJS

左心房为你撑大大i 提交于 2019-12-23 04:56:33
问题 I'm having a JSON Collection $scope.person = [ { "Id": 1 "Name": "John" }, { "Id": 2 "Name": "Jack" }, { "Id": 3 "Name": "Watson" }, ]; I'm having two HTML Select with same JSON Collection. I Selected a Person Watson in the First Select " Person ", then I need to update the Same in the Second HTML Select " Copy Person ". But I Can't able to update. I bind the JSON Object as a Value in the HTML Select instead of Id or Name <!DOCTYPE html> <html> <head> <title>HTML Select using AngularJS</title

jQuery toggle div from select option

本小妞迷上赌 提交于 2019-12-22 08:17:56
问题 I'm in need to toggle divs from a dropdown select option box. I'd like it similar to asmselect for jquery but instead of listing the option tag I'd like it to display a hidden div. Is there anything like this out there? Or anyone know how to set it up? Thanks, Jeff. UPDATED Basically what I want is the look and interaction of the asmselect link above though toggling divs instead of generating a list. Example code below: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:/

Execute script based on which option is selected in a select box?

↘锁芯ラ 提交于 2019-12-21 21:33:50
问题 I've got a select box where the user selects which elements they want to see based on option 1, option 2 and option 3. So what I'm trying to set up is have if option 1 is selected run one set of commands and if option 2 run another and so on. I guess I just need to know how to set up the jQuery selector. 回答1: You didn't specify how the code was triggered, so here are two common ways: $('#yourSelect').change(function() { if ($(this).val() == 'something') { // do this } if ($(this).val() ==

How to adjust Select drop-down height [duplicate]

倾然丶 夕夏残阳落幕 提交于 2019-12-21 12:41:12
问题 This question already has answers here : Height of an HTML select box (dropdown) (6 answers) Closed 4 years ago . 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 回答1: You