問題:
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