如何在更改事件中使用廣播? - How to use radio on change event?

問題:

I have two radio button on change event i want change button How it is possible?我有兩個關於更改事件的單選按鈕我想要更改按鈕 這怎麼可能? My Code我的代碼

<input type="radio" name="bedStatus" id="allot" checked="checked" value="allot">Allot
<input type="radio" name="bedStatus" id="transfer" value="transfer">Transfer

Script腳本

<script>
    $(document).ready(function () {
        $('input:radio[name=bedStatus]:checked').change(function () {
            if ($("input[name='bedStatus']:checked").val() == 'allot') {
                alert("Allot Thai Gayo Bhai");
            }
            if ($("input[name='bedStatus']:checked").val() == 'transfer') {
                alert("Transfer Thai Gayo");
            }
        });
    });
</script>

解決方案:

參考一: https://en.stackoom.com/question/tBfz
參考二: https://stackoom.com/question/tBfz
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章