【发布时间】:2021-12-29 02:19:36
【问题描述】:
我有多个带有标签的复选框,我想获取未选中复选框的标签,并在提交表单时将这些标签值发送到 php 文件。 我正在这样做,但没有工作
$('.checkbox_0').click(function() {
$("input:checkbox:not(:checked)").each(function() {
$(this).next('label').text()
});
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<input type="checkbox" id="firstCheckbox" name="firstCheckbox" class="checked_0">
<label for="firstCheckbox">Attendance to shifts are regular and no last minute shift cancellation</label>
<input type="checkbox" id="secondCheckbox" name="secondCheckbox" class="checked_0">
<label for="secondCheckbox">Attendance to shifts are regular and no last minute shift cancellation</label>
【问题讨论】:
-
请分享您的html代码。
-
问题已更新,请立即查看html代码
-
代码中不存在带有“checkbox_0”的类名。从哪里获得?
-
而你的函数什么也没做。
-
@RajuAhmed 请再次检查