A Pen by Davide Curletti on CodePen.
Yo - I was wondering if you knew what was wrong with my jquery code to get the values of my buttons? Specifically lines 6 and 7. Line 5 works fine.
<div class="form-group"> | |
<label for="dayType" class="control-label">Day Type</label> | |
<div class="controls"> | |
<div class="btn-group" data-toggle="buttons"> | |
<label class="btn btn-default"> | |
<input type="radio" name="dayType" id="option1" autocomplete="off" class="btn btn-default" data-value="Numerical">Numerical | |
</label> | |
<label class="btn btn-default"> | |
<input type="radio" name="dayType" id="option2" autocomplete="off" class="btn btn-default" data-value="Days">Day of Week | |
</label> | |
</div> | |
</div> | |
</div> |
Template.routineForm.events({ | |
'submit form': function (event, tpl) { | |
event.preventDefault(); | |
var routine = { | |
name: $(event.target).find('[name=routineName]').val(),//works fine | |
routineType: $(event.target).find('[name=dayType]').find('input:radio:checked').val(),//can't select the correct one | |
difficulty: $(event.target).find('[name=dayType][clicked=true]').data("value") //just trying it another way | |
}; | |
console.log(routine); | |
} | |
}); |
A Pen by Davide Curletti on CodePen.
Yo - I was wondering if you knew what was wrong with my jquery code to get the values of my buttons? Specifically lines 6 and 7. Line 5 works fine.