/ Published in: JavaScript

Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
// Get the value of the selected item $("#ComboBox").val(); // Get the text of the selected item $("#ComboBox option:selected").text() // Find out when the select value changed $("#ComboBox").change(function() { /* do something here */ }); // Programmatically set the selected item. $("#ComboBox").val(2); // Modify the list // Clear the list: $("#ComboBox").html(""); // Add to the list: $("<option value=’9’>Value 9</option>").appendTo("#ComboBox");
URL: http://elegantcode.com/2009/07/01/jquery-playing-with-select-dropdownlistcombobox/
Comments
