Sheikh 发布的答案很好,但这是另一种选择:
http://jsfiddle.net/Jun5z/
HTML:
<select class="mySelect">
<option value="">Please select an option</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
<select class="mySelect">
<option value="">Please select an option</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
<button class="myButton">Submit</button>
JavaScript:
$(document).ready(function(){
$('.myButton').click(function() {
$(".mySelect option:selected").each(function() {
// do something if it's not empty
if (this.value != '')
console.log(this.text);
});
});
});