checked ratio
HTML
<input type='radio' class='radio-button' name='one'>
<label>label 1</label>
<input type='radio' class='radio-button' name='two'>
<label>label 2</label>
<input type='radio' class='radio-button' name='three'>
<label>label 3</label>
<div class="show-one one box" style="display: none;">
<button>Button 1</button>
</div>
<div class="show-two two box" style="display: none;">
<button>Button 2</button>
</div>
<div class="show-three three box" style="display: none;">
<button>Button 3</button>
</div>
JavaScript
var radio_button = false;
$('input[type="radio"]').click(function() {
var inputValue = $(this).attr("name");
var targetBox = $("." + inputValue);
$(".box").not(targetBox).hide();
$(targetBox).fadeIn();
//alert('asd')
});
$('.radio-buttonhttp://jsfiddle.net/xjzutbr9/3/#').on("click", function(event) {
var this_input = $(this);
if (this_input.attr('checked1') == '1') {
this_input.attr('checked1', '1')
} else {
this_input.attr('checked1', '2')
}
$('.radio-button').prop('checked', false);
if (this_input.attr('checked1') == '1') {
this_input.prop('checked', false);
this_input.attr('checked1', '2');
$('.box').hide();
} else {
this_input.prop('checked', true);
this_input.attr('checked1', '1')
}
});