//Events when changing
$("#testSelect").change(function(){ //Event occurred
jQuery('option:selected', this).each(function(){ //Print out multiple selected values
alert(this.value);
});
});
//Print the selected item
Method 1: $("select#Clubs").children("[@selected]" ).each(function(){
alert(this.text);
});
Method 2: $("#selBags").val(); //This is faster, but Single selection only
//Get the selection value of the drop-down menu
$(#testSelect option:selected').text();
or $("#testSelect").find('option:selected ' ).text();
//Remove removeOption(index/value/regex[, selectedOnly])
$('select#Clubs option:selected').remove();
//Make an option selected
var select = $(tdsEdit[0]).find("select"); //Get select
$(select).children().each(function(){
if ( $(this).text()=="option you want")
//jQuery method
$(this).attr("selected","true"); //Or selected
//javascript method
this.selected = true;
});
Reference
http://www.texotela.co .uk/code/jquery/select/http://blog.jeremymartin.name/2008/02/easy-multi-select-transfer-with-jquery. html Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn