html-select

jquery/javascript select option randomly

倾然丶 夕夏残阳落幕 提交于 2020-01-03 04:52:08
问题 I want to select an option from select randomly. <select class=".sel" id="sel"> <option>a</option> <option>b</option> <option>c</option> <option>d</option> </select> actually i am using jQuery autocomplete. Well,the question is how can i select option randomly from a select box ? and what i tried is function change_something(opt) { var randomOption=Math.floor(Math.random()*$(opt+' option').size()); $(opt+ option["value='"+randomOption+"'"]).attr('selected', 'selected'); } Actually i am not a

How to do drop-down box like “More action” in gmail

我们两清 提交于 2020-01-02 07:06:27
问题 I see the "More Action" drop-down box in gmail inbox page. It has levels and some disabled item in the list. How to do that in HTML+CSS? Thank you 回答1: You can group and disable elements in an HTML <select> element without resorting to the use of JavaScript. Something like the following should work: <select name="foo"> <optgroup label="Odds"> <option value="1">1</option> <option value="3">3</option> <option value="5">5</option> </optgroup> <optgroup label="Evens"> <option value="2">2</option>

Multi-Selection horizontal

荒凉一梦 提交于 2020-01-02 03:29:28
问题 I'm trying to build a multi-selection like that: The height and width of each option is 100. The options are listed horizontally. The options have to make a line break if they are out of the browsers width . It looks like that at the moment: JSFiddle Demo * { box-sizing: border-box; } #data { overflow:hidden; padding:0; width:100vw; } select { padding:0; padding-left:1px; border:none; background-color:#eee; width:100vw; } option { height:100px; width:100px; border:1px solid #000; background

MVC @Html.DropDownList Getting Error with SelectList in ViewBag

戏子无情 提交于 2020-01-01 12:11:18
问题 I have a list which I created in the controller: var PayList = new[] { new ListEntry { Id = 1, Name = "" }, new ListEntry { Id = 2, Name = "Yes" }, new ListEntry { Id = 3, Name = "No" } }; ViewBag.PayList = new SelectList(PayList, "Id", "Name"); In the view I have the following: @Html.DropDownList("Pay", new SelectList(ViewBag.PayList,"Id","Name")) When I try to display it, it says the following: DataBinding: 'System.Web.Mvc.SelectListItem' does not contain a property with the name 'Id'. Not

django - post form on select

徘徊边缘 提交于 2020-01-01 03:09:10
问题 I made a simple django form, with a list of choices (in radio buttons): class MyForm(forms.Form): choices=forms.ChoiceField( widget=forms.RadioSelect(), choices=[(k,k) for k in ['one','two','three']],label="choose one") I would like the form to submit automatically when a user selects one of the options. In straightforward HTML I would've done it as <select name='myselect' onChange="FORM_NAME.submit();"> .... </select> But I do not know how to integrate this into the form class without

How to clear exisiting dropdownlist items when its content changes?

送分小仙女□ 提交于 2019-12-31 21:42:35
问题 ddl2 populates based on ddl1 selected value successfully. My issue is the data that is already present in ddl2 does not clear before appending the new data so ddl2 content just continues to grow every time ddl1 is changed. <asp:DropDownList ID="ddl1" RunAt="Server" DataSourceID="sql1" DataValueField="ID1" DataTextField="Name2" AppendDataBoundItems="True" AutoPostBack="True"> <asp:ListItem Text="ALL" Selected="True" Value="0"/> </asp:DropDownList> <asp:DropDownList ID="ddl2" RunAt="Server"

Object reference not set to instance of an object while getting data from request object/Formcollection

只愿长相守 提交于 2019-12-31 03:02:29
问题 i am trying to implement a simple add operation using MVC Ajax My code is as follows: Public Class Model { public int number1{get;set;} public int number2{get;set;} } [HttpPost] public string TestAjax( ) { int strnum1 = Convert.ToInt32(Request["txtbox1"].ToString()); int strnum2 = Convert.ToInt32(Request["txtbox2"].ToString()); string strnum3 = Convert.ToString(strnum1 + strnum2); if (strnum3 != null) { return strnum3; } return string.Empty; } It is hitting the Ajax action method. But, i was

HTML select shows value instead of text

馋奶兔 提交于 2019-12-30 08:16:12
问题 Is it possible in a html select , to display the value of the option instead of the text? It's gonna be used for displaying a long disription in the dropdown, but when selecting it should only be showing a short text/ the value of the option. code: <select> <option value="1">This is a long long text, that explains option 1</option> <option value="2">This is a long long text, that explains option 2</option> </select> Now the selected item, when you leave the dropdown/combobox/whatever, should

How to make a custom select option menu style without image in CSS?

爱⌒轻易说出口 提交于 2019-12-30 05:22:10
问题 [I don't want the Unicode character] For example: With using Black down-pointing triangle. It'll using -webkit-appearance: none; to make it look better. It would be simple as: Select ▼ to Select ▼ Value1 Value2 or something similar HTML: <select> <option>Value1</option> <option>Value2</option> </select> QUESTION: How to do it in pure CSS, without any JavaScript? 回答1: Select boxes are not really styleable, so I wouldn't be surprised if this was impossible. Some limited styling options are

Add a select field that will change price in Woocommerce simple products

牧云@^-^@ 提交于 2019-12-29 09:22:06
问题 I need to add a select with a custom price in the single product as seen in the screenshots below; The idea is that by selecting an option from (select) you can increase it to the base price. Without using the variations, since my idea is to do other things more, but I need help on how to do this. I've seen plugins that do it are called "Add-On" but I do not want to use a plugin. 回答1: To add a select field in simple products (like in variable products) that will update base price depending on