Basic Show/Hide w/ radio buttons
by chayacooper
HTML
<div id="body_part_primary" name="body_part_primary">1rst</div>
<div id="body_part_secondary" name="body_part_secondary" style="display:none">I'm hidden</div>
<br/>
<div id="body_part_info">
<input type="text" class="hide" name="body_shape_importance" />
<input type="radio" name="body_shape_importance" checked="checked" value="PrimaryShape" />Primary Shape</label>
<input type="radio" name="body_shape_importance" value="ToneCellulite" />Tone/Cellulite
<input type="radio" name="body_shape_importance" value="SecondaryShape" /> Secondary Shape
</div>
JavaScript
$(document).ready(function(){
//var current_Importance = $("input:radio[name=body_part_description]:checked");
//$("#body_part_primary, #body_part_secondary").hide();
$('[name="body_shape_importance"]').change(function () {
if( $("input:radio[name=body_shape_importance]:checked").val() === "SecondaryShape"){
$("[name=body_part_primary]").hide();
$("[name=body_part_secondary]").show();
}
else {
$("[name=body_part_secondary]").hide();
$("[name=body_part_primary]").show();
}
});
});