New to jquery question…
Using jQuery, depending on the radio button clicked I would like jQuery auto ‘check’ the corresponding checkbox.
<input type="radio" value="#ID#" name="#ID#1"
onclick="return tickSession(this);"/>
<input type="checkbox" value="#ID#" id="#ID#"
name="sessionsThatNeedBookingOnto" class="#ID#1"/>
<input type="radio" value="#ID#" name="#ID#1"
onclick="return tickSession(this);"/>
<input type="checkbox" value="#ID#" id="#ID#"
name="sessionsThatNeedBookingOnto" class="#ID#1"/>
<input type="radio" value="#ID#" name="#ID#2"
onclick="return tickSession(this);"/>
<input type="checkbox" value="#ID#" id="#ID#"
name="sessionsThatNeedBookingOnto" class="#ID#2"/>
This is what I have tried but my understanding is a little off…
<script>
function tickSession(elementHere){
alert($(elementHere).val());
$(elementHere).attr('id').attr("checked", "true");
$($(elementHere).val()).attr('checked','checked')
}
</script>
Let’s rework your checkboxes/radios:
Now:
What this does is:
rd-session-control.:checkedselector to test if the checkbox is active or not.