Posted By

vbchrisw on 11/23/10


Tagged

input


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

swarmtoten
mmcachran


DropDownList


 / Published in: jQuery
 

  1. // Get the value of the selected item
  2. $("#ComboBox").val()
  3.  
  4. // Get the text of the selected item
  5. $("#ComboBox option:selected").text()
  6.  
  7. // Find out when the select value changed
  8. $("#ComboBox").change(function() { /* do something here */ });
  9.  
  10. // Programmatically set the selected item
  11. $("#ComboBox").val(2);
  12.  
  13. // Clear the list
  14. $("#ComboBox").html("");
  15.  
  16. // Add to the list:
  17. $("<option value=’9’>Value 9</option>").appendTo("#ComboBox");
  18.  
  19. // Select All options
  20. $('fieldset select option').attr('selected','selected');

Report this snippet  

You need to login to post a comment.