html-select

Select value from dropdown list using the text

和自甴很熟 提交于 2019-12-18 09:45:39
问题 How do you select a value from a dropdown list, by using the text, instead of the value or the index? The HTML: <select name="category_group" id="category_group" sel_id="" > <option value="0" selected="selected">Kies de rubriek</option> <option value='1000' style='background-color:#dcdcc3;font-weight:bold;' disabled="disabled" id='cat1000' > -- VOERTUIGEN -- </option> <option value='1020' id='cat1020' > Auto's </option> <option value='1080' id='cat1080' > Auto's: Onderdelen </option> <option

Set tag's size attribute through css?

只谈情不闲聊 提交于 2019-12-18 07:40:58
问题 Normally you can do this: <select size="3"> <option>blah</option> <option>blah</option> <option>blah</option> </select> And it would render as a selectionbox where all three options are visible (without dropping down) I'm looking for a way to set this size attribute from css. 回答1: There ins't an option for setting the size, but if you do set the size some browsers will let you set the width/height properties to whatever you want via CSS. Some = Firefox, Chrome, Safari, Opera. Not much works

Dynamic drop down list using html and php

孤街醉人 提交于 2019-12-18 05:36:51
问题 I'm learning html and php, I have a mysql DB employees where there is a table called Employees_hired, which stores id, name, department and type of contract. I want to make a drop down list of employees who belong to a type of department and a specific contract type. In the code would be something like: <html> <head> <title>Dynamic Drop Down List</title> </head> <body> <form id="form1" name="form1" method="post" action="<?php $_SERVER['PHP_SELF']?>"> department: <select id="department" name=

Any way to prevent “deselection” of highlighted text?

删除回忆录丶 提交于 2019-12-18 04:48:32
问题 Highlight some text on this webpage, then click basically anywhere on the document. Your selection will disappear. Is there a way to prevent this behavior when the user clicks on a specific element, either by CSS or Javascript? E.g.: var element = document.getElementById("foo"); foo.onclick = function(e){ //some magic here that prevents deselection from occuring } or foo.style.preventDeselect = "true"; Edit: Perhaps I could store the selection, then after "mouseclick" restore the selection?

Razor DropDownListFor: Adding Extra Attribute To SelectList Option Tag

China☆狼群 提交于 2019-12-18 03:44:46
问题 I'm trying to create a select list. I've created it just fine using a collection from my viewmodel that allows me to set each option's value and text with the following code: @Html.DropDownListFor(model => model.Networks, new SelectList(Model.Networks, "NetworkID", "Name"), new { @class="form-control" }) Model.Networks contains another property called CountryId. I'd like to add an attribute to each option tag so it looks like: <option value="[NetworkId]" data-countryId="[CountryId]">Canada<

Angularjs ngOption with array

拜拜、爱过 提交于 2019-12-18 03:05:11
问题 I want to add an html select with options AM,PM with angularjs, what i need is having the key and the value of the option be the same : <option value="AM">AM</option> <option value="PM">PM</option> My html looks like this <select ng-model="ampm" ng-options="k as v for (k , v) in ampms"></select> and my controller looks like $scope.ampm = (new Date().getHours()) >= 12 ? 'PM' : 'AM'; $scope.ampms ={"AM":"AM","PM":"PM"}; and every thing working fine. My question is why i cant have the same thing

CasperJS/ Javascript Selecting Multiple Options

微笑、不失礼 提交于 2019-12-17 21:31:08
问题 Trying to scrape a website, where this is the generic HTML code <select id="xxx" multiple name="zzz"> <option value="123">xaxaxa</option> <option value="124">zazaza</option> <option value="125">ajajaj</option> <option value="126">azzzsa</option> </select> It is not enclosed by a form so I tried using the fill() function that casperjs provides but that did not work. For single entries, I would usually casper.click() and that would work but this does not work for multiple entries even with

Preserve whitespace in html select element options using “white-space: pre” NOT working

白昼怎懂夜的黑 提交于 2019-12-17 20:44:22
问题 My problem comes from HTML dropdown select not able to preserve multiple consecutive whitespaces in its options. Here is a sample testcase and outcome. The "white-space:pre" class css seems to work only for any html element except the select element options. Is there any literature or cases identifying such issue? Any suggestions/ advise helpful print "<style>.keepwhitespace { white-space: pre }</style> <p class='keepwhitespace'>abc def</p> abc def <br/> <br/>select and options with

CSS background-image issue for <select> & <option>

白昼怎懂夜的黑 提交于 2019-12-17 20:26:42
问题 HTML <select data-val="true" id="GameID" > <option value="">Select Game...</option> <option value="4">Counter Strike Source</option> <option value="5">Medal Of Honor</option> <option value="6">NFS Shift</option> </select> CSS select { color: #fff; background: url(/img/backgrounds/tab-hover-background.png) rgba(0,0,0,0); border: 1px solid #8093BE; width: 242px; height: 20px; } option { background: url(/img/backgrounds/tab-hover-background.png) rgba(0,0,0,0); } In Firefox it works fine, In

jQuery and css: hide/show select options with a certain css class

感情迁移 提交于 2019-12-17 19:18:15
问题 In the html code I have select options like this: <option value="1" class="myclass5">Value1</option> In jQuery: var cod = $(this).val(); // This is the value of another select: when the value $("option[class^=myclass]").hide(); $("option[class^=myclass]").each(function () { $("option[class^=myclass" + cod + "]").show(); }); EDIT I have two select. When I select a value in the first select, the second one must be populated accordingly (I have to prevent an ajax call). I put all the second