我无法让这个工作!用动态收音机显示/隐藏div不起作用
当我检查第二个单选按钮时,显示类名称为wholesale-option
的div。当我取消选中单选按钮时,div不会隐藏。我在做什么错了?
见我Fiddle
$(document).ready(function() {
$('.gui-block-option:first').nextAll().addClass('wholesale-option');
var newContainer = $('<div class="gui-spacer"></div><div class="gui-block-option"><div class="gui-field"><div class="gui-radio"><div class="tm-radio"><input type="radio" value="" name="shipment_method" id="gui-form-shipping-wholesale" class=""></div><label for="gui-form-shipping-wholesale">Ik wil graag bij mijn groothandel bestellen(Afhalen)</label></div><div class="gui-field-content"><p>text over bestellen bij groothandel</p></div></div></div>');
$('#gui-form .gui-block-option:first').after(newContainer);
$(".wholesale-option").hide();
$("#gui-form-shipping-wholesale").change(function() {
if ($(this).prop('checked', true)) {
$(".wholesale-option").show();
} else if ($(this).prop('checked', false)) {
$(".wholesale-option").hide();
}
});
});
我试过的东西this.checked
和上面.prop
但都不是工作。
请帮助..
页面中只有2个“radio”吗?或者** [DEMO](http://jsfiddle.net/Guruprasad_Rao/7h4q4wx1/7/)**会做什么? –