if statement - jquery is checked on radio button -
so, have 3 radio buttons:
<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'; ?> /> and i'm trying check if radio button value timer checked so
if($('.radio [value=timer]').is(':checked')) { console.log('timer'); } but i'm doing wrong since code above doesn't work. so, right way it? using .change()?
demo http://jsfiddle.net/m4m57/5/
issue space here f ($('.radio [value=timer]').is(':checked')) {
^----------- hope helps,
code
$('input').on('change', function() { if ($('.radio[value=timer]').is(':checked')) { alert('say what'); console.log('timer'); } });
Comments
Post a Comment