Return to Snippet

Revision: 15376
at July 2, 2009 16:47 by sveggiani


Initial Code
// 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");

Initial URL
http://elegantcode.com/2009/07/01/jquery-playing-with-select-dropdownlistcombobox/

Initial Description


Initial Title
manage select boxes with jQuery

Initial Tags
jquery

Initial Language
JavaScript