所以,我有3個單選按鈕:jQuery是單選按鈕選中
<input type="radio" name="status" value="enabled" class="radio" <?php if($news_row['status']==1) echo 'checked'; ?> />
<input type="radio" name="status" value="disabled" class="radio" <?php if($news_row['status']==2) echo 'checked'; ?> />
<input type="radio" name="status" value="timer" class="radio" <?php if($news_row['status']==3) echo 'checked'; ?> />
而且我想,以檢查是否有值定時器單選按鈕被選中,像這樣
if($('.radio [value=timer]').is(':checked')) {
console.log('timer');
}
但很明顯由於上面的代碼不起作用,我做錯了什麼。那麼,這是正確的做法嗎?使用.change()
?