我正在填写表格并希望有一个复选框,如果选中了更多表格,这不是问题,但是当表格出现时我想验证它们,需要class=""
要如何设置?验证动态补充表格
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Show div on check for checkbox</title>
<script type="text/javascript" src="jquery.js"></script>
</head>
<body>
<form>
Check me <input name="checkbox" type="checkbox" id="checkbox" onclick="$(this).is(':checked') && $('#checked').slideDown('slow')|| $('#checked').slideUp('slow');" />
<p id="checked" style="display: none; margin: 10px; height: 100px; background-color: #f5f5f5; padding: 10px" >
<label for="form">input?</label>
<input class="" type="text" name="form" id="form">
</p>
<script>
$("input.checkbox").click(function() {
if ($(this).is(":checked")) {
$("input.form").addClass("required");
Else
$("input.form").removeClass("required");
}
});
</script>
</form>
</body>
</html>
这是我的代码,似乎没有工作,当我检查源代码之前和之后其相同。