您好,所有即时通讯都附有一些代码,希望能获得帮助。我有这样的html设置:
基本上,我想做的是在jquery中,如果选中了parent_required class复选框,则获取child类下的所有输入字段以及child_required的所有输入字段类取消选中它们。
我不能在输入字段上使用id',因为我只是不知道要使用的所有id。
到目前为止,在jQuery中我有此代码
$('.parent_required').click(function() {
if(!$(this).is(":checked")) {
var child = $(this).parent('.parent_options').siblings('.children');
}
});
我在div class ='孩子们那里很烂,孩子们不知道该如何深入。
最佳答案
尝试这个:$('.parent_required').click(function() {
if (!$(this).is(":checked")) {
$(this).closest('.parent_options')
.siblings('.children')
.find('.child_required')
.prop('checked', false);
}
});
Example fiddle