current_Importance + current_BodyPart
by chayacooper
HTML
<div id="body_part_info" class="headerFont">
<label><input type="radio" name="body_shape_importance" class="show_value" checked="checked" value="PrimaryShape" />Primary Shape</label>
<label><input type="radio" name="body_shape_importance" class="show_value" value="ToneCellulite" />Tone/Cellulite</label>
<label><input type="radio" name="body_shape_importance" value="SecondaryShape" /> Secondary Shape</label>
</div>
<div id="body_part_primary" >
<select name="body_part">
<option value="bust" >Bust</option>
<option value="Hips">Hips</option> <!-- measurements_hips -->
<option value="Waist">Waist</option><!-- measurements_waist -->
</select>
</div>
<div id="body_part_secondary" >
<select name="body_part">
<option value="stomach">Stomach</option>
<option value="Height">Height</option> <!-- Measurements height_ft height_in -->
<option value="Weight_description">Weight</option> <!-- Measurements - weight -->
</select>
</div>
<div id="body_part_muscle_cellulite">
<select name="body_part">
<option value="thigh_muscle_tone">Thighs</option>
<option value="bottom_muscle_tone">Butt</option>
<option value="arm_tone">Upper Arm</option>
</select>
</div>
<div id="primary_body_description1">1
<label><input type="radio" name="body_part_description" value="Small" />Small</label>
<label><input type="radio" name="body_part_description" value="Large" />Large</label>
</div>
<div id="primary_body_description2" style="display:none">2
<label><input type="radio" name="body_part_description" value="Narrow" />Narrow</label>
<label><input type="radio" name="body_part_description" value="Wide" />Wide</label>
</div>
<div id="primary_body_description3" style="display:none">3
<label><input type="radio" name="body_part_description" value="Flat" />Flat</label>
</div>
JavaScript
$(function() {
var current_Importance = $('input:radio[name="body_shape_importance"]');
var current_BodyPart = $('select[name="body_part"]');
$("#body_part_primary, #body_part_muscle_cellulite, #body_part_secondary").hide();
$("#primary_body_description1, #primary_body_description2, #primary_body_description3, #primary_body_description4, #primary_body_description5").hide();
$('input:radio[name="body_shape_importance"]').change(function () {
// $("#body_part_primary, #body_part_muscle_cellulite, #body_part_secondary").hide();
if( $(current_Importance).val() === "PrimaryShape"){
$("#body_part_primary").show();
$("#body_part_muscle_cellulite, #body_part_secondary").hide();
}
else if( $(current_Importance).val() === "ToneCellulite"){
$("#body_part_muscle_cellulite").show();
$("#body_part_primary, #body_part_secondary").hide();
}
else if( $(current_Importance).val() === "SecondaryShape"){
$("#body_part_secondary").show();
$("#body_part_primary, #body_part_muscle_cellulite").hide();
}
else {
$("#body_part_primary, #body_part_muscle_cellulite, #body_part_secondary").hide();
}
});
$('select[name="body_part"]').change(function () {
$("#primary_body_description1, #primary_body_description2, #primary_body_description3, #primary_body_description4, #primary_body_description5").hide();
if( $(current_BodyPart).val() === "bust"){
$("#primary_body_description1").show();
}
else if( $(current_BodyPart).val() === "Hips"){
$("#primary_body_description2").show();
}
else if( $(current_BodyPart).val() === "Waist"){
...