所以,我有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()
?