Home > Web Front-end > CSS Tutorial > How to Select All Checkboxes Except `#select_all` with jQuery?

How to Select All Checkboxes Except `#select_all` with jQuery?

DDD
Release: 2024-11-10 19:47:03
Original
516 people have browsed it

How to Select All Checkboxes Except `#select_all` with jQuery?

Select All Checkboxes Except #select_all with jQuery

In order to manipulate checkboxes using jQuery selectors, you can utilize the following markup:

<form>
  <table>
    <tr>
      <td><input type="checkbox">
Copy after login

To select all checkboxes except for the one with the ID select_all, you can use the below jQuery code:

$('#select_all').change(function() {
  var checkboxes = $(this).closest('form').find(':checkbox');
  checkboxes.prop('checked', $(this).is(':checked'));
});
Copy after login

This script will enable you to select all checkboxes within the form when the #select_all checkbox is clicked.

The above is the detailed content of How to Select All Checkboxes Except `#select_all` with jQuery?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template