<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>练习</title>
<script type="text/javascript" src="http://cdn.gbtags.com/jquery/1.11.1/jquery.min.js"></script>
<style type="text/css">
</style>
</head>
<body>
<select id="myselect" size="5">
<option val="c">选项C</option>
<option val="d">选项D</option>
<option val="b">选项B</option>
<option val="e">选项E</option>
<option val="a">选项A</option>
</select>
</body>
</html>
<script type="text/javascript">
var options={};
$("#myselect option").each(function(){
var option=$(this);
options[option.text()]=option;
});
var keys=Object.keys(options).sort();
var $myselect=$("#myselect").empty();
$.each(keys,function(i,key){
$myselect.append(options[key]);
})
</script>