Design Templates. The value -1 indicates that no element is selected. However, the value of the value attribute is what will be sent to the server when a form is submitted. There seems to be an issue with select drop down controls not dynamically changing when the controls are dynamically created instead of being in a static HTML page. In this example of getting the value of selected option of HTML dropdown, a form is created with a 4. The HTML in jQuery, how to set selected? What will happen if a legally dead but actually living person commits a crime after they are declared legally dead? Use the element. Idempotent Laurent polynomials (in noncommuting variables), RAID level and filesystem for a large storage server. Now your option 4 will be selected. You can select on any attribute and its value by using the attribute selector [attributename=optionalvalue], so in your case you can select the option and set the selected attribute. This will give you whatever value is on the select dropdown per click. If you had an array that has name-value pairs and you wanted to use the index from the array as the value for the options and the array value as the text to display, you could do this: Assuming that the dropdown menu named list name="list" and included in a form with name attribute name="form1". As the div has a class to target the select inside it, code will be: If the class would have been given to select itself, code will be: To pass the value dynamically, code will be: The content of the value attribute for the in jQuery, how to set selected? The select tag helper uses the name of the property to generate values for the name and id attributes on the rendered select element. If no option selected then nothing will be returned. The following example is used to illustrate the main features of these two HTML elements: This renders as Select a numberOneTwoThree The select element has a name attribute. Why is it so hard to build crewed rockets/spacecraft able to reach escape velocity? Run. We demonstrate this with the following example. The control is to only allow one option to be selected. $("div#YOUR_ID").val(VALUE_CHANGED).change(); The dropdown list. Join Stack Overflow to learn, share knowledge, and build your career. He wants not the value but the shown text of the select box. Get selected value in dropdown list using JavaScript, Get selected text from a drop-down list (select box) using jQuery. Be careful: val() may set values that do not exist in options. The element can also be used for grouping those