I want to hide all children divs except first one. When I select a radio option from first div, show the second one. This is my code.
<?php if ($options) { ?>
<div class="options <?php echo $this->journal2->settings->get('product_page_options_push_classes'); ?>">
<h3><?php echo $text_option; ?></h3>
<?php foreach ($options as $option) { ?>
<?php if ($option['type'] == 'radio') { ?>
<div class="option form-group<?php echo ($option['required'] ? ' required' : ''); ?> option-<?php echo $option['type']; ?>">
<label class="control-label"><?php echo $option['name']; ?></label>
<div id="input-option<?php echo $option['product_option_id']; ?>">
<?php foreach ($option['product_option_value'] as $option_value) { ?>
<div class="radio">
<label>
<input type="radio" name="option[<?php echo $option['product_option_id']; ?>]" value="<?php echo $option_value['product_option_value_id']; ?>" class="clickclass" />
<?php echo $option_value['name']; ?>
<?php if ($option_value['price']) { ?>
(<?php echo $option_value['price_prefix']; ?><?php echo $option_value['price']; ?>)
<?php } ?>
</label>
</div>
<?php } ?>
</div>
</div>
<?php } ?>
<?php } ?>
</div>
<?php } ?>
Here is my output.
By default, only first set of options "Custom Size" should appear. When I click on any of the radio button, the next set "Custom Style" should appear.
Is there any way to achieve it?
Do you need something like this:
<html>
<head>
<style>
div {
border: 1px solid;
margin: 20px;
padding: 20px;
width: 200px;
}
.secound {
display: none;
}
</style>
<script>
//you need jQuery
$(function(){
$('.first input').change(function(){
$('.secound').fadeIn('slow')
})
});
</script>
</head>
<body>
<div class="first">
<p>First Div</p>
<label>small</label><input type="radio" name="name" value="value">
<label>medium</label><input type="radio" name="name" value="value1">
<label>large</label><input type="radio" name="name" value="value2">
</div>
<div class="secound">
<p>Secound Div</p>
<label>small</label><input type="radio" name="name1" value="value">
<label>medium</label><input type="radio" name="name1" value="value1">
<label>large</label><input type="radio" name="name1" value="value2">
</div>
</body>
See demo: http://jsfiddle.net/sabeti05/73oprqv0/