2012-06-28 107 views
0

全部, 我在我的頁面上有多個選擇全部具有相同的類別。這個類被稱爲event_selection。每當有人改變這些選擇中的一個時,我想用jQuery獲得選定的選項值。獲得期權改變的價值選擇

我該怎麼做呢?

謝謝!

回答

1
$('.event_selection').on('change', function() { // bind change event 
    // get the value 
    alert(this.value); // or $(this).val(), but previous one is faster 
}); 
1
$('.event_selection').change(function(){ 
    alert($(this).val()); 
}); 

此線可能是500和,雖然別人的重複...