【发布时间】:2012-06-28 19:10:02
【问题描述】:
所以,我有 3 个单选按钮:
<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()?
【问题讨论】:
标签: jquery if-statement radio-button checked