简体   繁体   English

如何使用jQuery忽略发送到服务器的元素列表中的“全选”复选框?

[英]How do I use jQuery to omit the “Select All” check box from the list of elements sent to the server?

When the "Select All" check box is used, it also sends that check box and it's value to the server. 使用“全选”复选框时,它还将该复选框及其值发送到服务器。 How do I remove or omit it from the node list before sending it to the server using jQuery? 在使用jQuery将其发送到服务器之前,如何从节点列表中删除或忽略它?

Thank You. 谢谢。

最简单的方法是不给它起一个名字:)

<input type="checkbox" />

You're looking for the remove function: 您正在寻找remove功能:

$('#someId').remove();

However, it will not do anything if the user has Javascript disabled. 但是,如果用户禁用了Javascript,它将不会执行任何操作。

I highly recommend that you change the server-side code to ignore that checkbox. 我强烈建议您更改服务器端代码以忽略该复选框。

Try this: 尝试这个:

$(".checkbox :not[id=chkcheckAll]").each(function(){//what needs to be done});

Assuming the id for Check all checkbox is chkCheckAll. 假设“检查所有”复选框的ID为chkCheckAll。

HTH 高温超导

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 当我使用jQuery单击选择按钮时,如何选择所有复选框 - How do I select all check box when I click on Select button using jQuery 如何使用jQuery选择列表中所有具有子元素的元素? - How do I select all of the elements in a list that have children, using jQuery? 如何根据jQuery中所有元素的内容选择元素? - How do I select elements based on all their content in jQuery? 如何使用jQuery检查数组中的所有元素 - How to check all elements in array use jQuery 我如何 select 所有 p 标签并在单击复选框时使它们可见? - How do I select all p tags and make them visible when check box is clicked? 使用JavaScript或jQuery,如何检查选择框是否与原始值匹配? - Using JavaScript or jQuery, how do I check if select box matches original value? 如何从列表中选择所有可见元素? - How to select all visible elements from list? 如何获取所有没有使用 jQuery 选择选项的选择元素? - How do I get all select elements that do not have an option selected using jQuery? 我正在创建一个带有 react-native-elements 的复选框列表。 如何一次只选中一个框? - I am creating a checkbox list with react-native-elements. How do I check only one box at a time? 如何在“主要”元素中选择所有“子”元素 - How do I select all “sub” elements inside “main” elements
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM