html-select

How to set the 'selected option' of a select dropdown list with jquery

邮差的信 提交于 2019-12-02 17:07:55
I have the following jquery function: $.post('GetSalesRepfromCustomer', { data: selectedObj.value }, function (result) { alert(result[0]); $('select[name^="salesrep"]').val(result[0]); }); result[0] is a value that I want to set as the selected item in my select box. result[0] equals Bruce jones . the select box is populated by a database query but one of the rendered html is: <select id="salesrep" data-theme="a" data-mini="true" name="salesrep"> <option value=""> </option> <option value="john smith">john smith</option> <option value="Bruce Jones">Bruce Jones</option> <option value="Adam

Fill HTML dropdown box with external JSON file data

喜你入骨 提交于 2019-12-02 16:24:40
问题 I am trying to fill a HTML Dropdown menu with data from an external JSON file, which contains the following { "Destinations": [ { "destinationName": "London", "destinationID": "lon" }, { "destinationName": "New York", "destinationID": "nyc" }, { "destinationName": "Paris", "destinationID": "par" }, { "destinationName": "Rome", "destinationID": "rom" } ] } What I would like is the drop down menu to display the destinationName, such as London, New York etc but i'm confused as how to approach

How to fill cascading dropdownlist each other by using jquery in mvc 3?

最后都变了- 提交于 2019-12-02 15:56:24
问题 how to load cascading dropdownlist each other asp.net mvc3? how can i do? i have been utilizing from http://geekswithblogs.net/ranganh/archive/2011/06/14/cascading-dropdownlist-in-asp.net-mvc-3-using-jquery.aspx but i can not. what is mymistake? i added debug red point on LoadJobByCustomerId method. But not working.Pleqase dont say make googling i do it in 48 hours... View: <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/ChildSite.Master" Inherits="System.Web.Mvc.ViewPage

How to set Pre selected data in dynamic select option in IONIC

≯℡__Kan透↙ 提交于 2019-12-02 15:03:25
问题 I face a strange problem where I need to show Pre selected data(which also come from server) in select option. The problem that I need to show select option based on key and value option. <div class="list list-inset"> <span class="input-label">Permisstion</span> <select ng-model="permisstion" > <option ng-repeat="(key, value) in Roles" id="{{key}}" value="{{value}}">{{value}}</option> </select> </div> JSON Data "Roles": { "21": "Admin", "22": "Main Manager", "23": "Branch Manager", "26":

Prevent iPhone from zooming form?

半世苍凉 提交于 2019-12-02 14:22:26
The code: <select> <option value="1">Home</option> <option value="2">About</option> <option value="3">Services</option> <option value="4">Contact</option> </select> When I touch select , the iPhone zooms in that element (and does not zoom out after deselecting). How can I prevent this? Or zoom back out? I can't use user-scalable=no because I actually need that functionality. It's for iPhone, select menu. UPDATE : This method no longer works on iOS 10. It depend from the Viewport, you can disable it in this way: <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1

<SELECT multiple> - how to allow only one item selected?

ε祈祈猫儿з 提交于 2019-12-02 14:07:24
I have a <SELECT multiple> field with multiple options and I want to allow it to have only one option selected at the same time but user can hold CTRL key and select more items at once. Is there any way how to do it? (I don't want to remove 'multiple'). Marcos Placona Just don't make it a select multiple, but set a size to it, such as: <select name="user" id="userID" size="3"> <option>John</option> <option>Paul</option> <option>Ringo</option> <option>George</option> </select> Working example: https://jsfiddle.net/q2vo8nge/ MacGucky If the user should select only one option at once, just remove

next 7 days in drop-down list [duplicate]

廉价感情. 提交于 2019-12-02 14:05:24
问题 This question already has answers here : How to get next seven days from X and format in JS (6 answers) Closed 4 years ago . I'd like the next 7 days to appear in a drop-down list. However my code doesn't seem to work. Please note that the date format has to be yyyy-mm-dd . Could you please help me. Here is my code: function formatDate(date) { var d = new Date(date), month = '' + (d.getMonth() + 1), day = '' + d.getDate(), year = d.getFullYear(); if (month.length < 2) month = '0' + month; if

Selecting div in custom dropdown using Keyboard (Up, down and enter keys)

让人想犯罪 __ 提交于 2019-12-02 09:54:48
I have simulated a dropdown look alike using div. I have also implemented search functionality for the values in dropdown div. I am trying to select the options in div dropdown using keys. When i search for a particular query and try to select the options presented, its not working. Can anyone please suggest solution. Code present here ---> http://jsbin.com/ujimih/2/edit Updated code present here ---> http://jsbin.com/ujimih/10/edit 来源: https://stackoverflow.com/questions/16573869/selecting-div-in-custom-dropdown-using-keyboard-up-down-and-enter-keys

Getting error when using post method in form

与世无争的帅哥 提交于 2019-12-02 09:47:10
I am getting null when I am using post method while passing a form to the next page A repeat of this question link text <html> <head> Title <script> function callme() { alert("Hi"); alert(document.getElementById("prio").value); } </script> </head> <body> <FORM method="post" name="test"enctype="multipart/form-data" action="testjsp.jsp" > <select name="prio" id="prio"> <option>1</option> <option>2</option> </select> <input type="submit" value="Submit" onClick=callme();> </form> </body> </html> IN testjsp.jsp I am trying to prin the prio variable which I am not able to do and its prining null.I

Formatting dates in an MVC Dropdown

空扰寡人 提交于 2019-12-02 08:28:09
I have a dropdown list on my page as so: - @Html.DropDownList("dd_dates", new SelectList(@Model.seasonDates), "Please Select") where seasonDates is an IList of dates. The problem is that when the dates are displayed in the dropdown they also have the time on them as well. How do I format the display date so that the time is not included. Maybe a better way to do this would be to define a property in your model that returns IEnumerable<SelectListItem> (in your model class): public DateTime SelectedDate {get;set;} public IEnumerable<SelectListItem> SeasonDates { get { foreach (var item in