I have a simple form:
First of all the id on the element should be radio10
and not #radio10
.
Then use this code
$("input[name='color']").change(function () {
if ($('input#radio10').is(':checked') ) {
$('.block-cms').show()
}
else {
$('.block-cms').hide();
}
});
Your id
shouldn't have the #
, that's for the selector, it should just be id="radio10"
.
Change that, and this is what you should be after:
$(".class_a :radio").change(function () {
$(".block-cms").toggle($("#radio10:checked").length > 0);
});
You can test it out here.
Here's another solution (IMO having an id on an <input type="radio">
seems a bit wrong to me):
$("input[name='color']").change(function () {
if ($(this).val() == 1) {
$('.block-cms').show()
}
else {
$('.block-cms').hide();
}
});