【发布时间】:2015-04-28 16:53:31
【问题描述】:
我想创建一个函数,该函数可以提交所有带有选中复选框的公式,并使用它们各自的 div 标签隐藏
我以下面的代码为例
<html>
<script>
//the jquery function to submit all forms
$(function () {
$(".formerasemessage").each(function () {
var par_div = $(this).closest(".demo"); //finding the closest div
$(this).validate({
submitHandler: function (formbeingsubmitted) {
$.post('remove.php', $(formbeingsubmitted).serialize(), function (data) {
$(formbeingsubmitted).hide("slow");
par_div.hide('slow'); //hide the div
});
}
});
});
});
</script>
<body>
<div class="demo">
<form method="post" class="formerasemessage">
<input type="checkbox" id="checkItem"></form>
</div>
<div class="demo">
<form method="post" class="formerasemessage">
<input type="checkbox" id="Checkbox1"></form>
</div>
<div class="demo">
<form method="post" class="formerasemessage">
<input type="checkbox" id="Checkbox2"></form>
</div>
<input type="button" value="Submit all checked">
</body>
</html>
我需要重新编写函数 Jquery 以便它可以执行所需的功能。
视觉结果会是这样的:
这是我的 Outlook 收件箱,检查了我的邮件,然后我点击“删除”,我的电子邮件被隐藏并删除了
【问题讨论】:
标签: javascript jquery web-applications