轉自 http://stackoverflow.com/questions/13152927/how-to-use-radio-on-change-event

--

ou can use this which refers to the current input element.

 

$(document).ready(function() {
    $('input[type=radio][name=bedStatus]').change(function() {
        if (this.value == 'allot') {
            alert("Allot Thai Gayo Bhai");
        }
        else if (this.value == 'transfer') {
            alert("Transfer Thai Gayo");
        }
    });
});

 

http://jsfiddle.net/4gZAT/

--

arrow
arrow
    全站熱搜

    dizzy03 發表在 痞客邦 留言(0) 人氣()