layui 复选框,单选框重置问题

//预先重置
	$("input[type='checkbox'][name*='no']").prop('checked', true);
	$("input[type='checkbox'][name='cert[px]']").prop("checked", false);
	$("input[type='radio'][name*='gj']").prop("checked", false);
//获取数据
	res.data.data.forEach(function(element, index) {
		$("input[type='checkbox'][name*='no']").prop('checked', false);
		$("input[type='checkbox'][value='" + element.type + "']").prop("checked", true);
		$("input[name='gj'][value='" + element.type + "']").prop("checked", true);
		if($("input[name='gj']:checked").length > 0) {
			$("input[type='checkbox'][name*='cert[gj]']").prop('checked', true);
			}
		})
发布了58 篇原创文章 · 获赞 0 · 访问量 5103

猜你喜欢

转载自blog.csdn.net/qq_40295815/article/details/104799585