How to check / uncheck all check boxes using jQuery?

You may have noticed select/deselect all functionality on websites like gmail.com, outlook.com or even in the wordpress admin dashboard basically which allows you to select all emails or posts on the page with single click. Which can be convenient to have check / uncheck multiple checkboxes with single click especially if the list is vast.

Here is the code snippet:

HTML:

JQuery:

What happens in this code is when user clicks “Select All” checkbox, the code first checks the status of checkbox with id “selecctall”, and loops thought each checkbox with class ‘permission’ and applies “selecctall” checkbox status to all other checkboxes.

That is it. I hope you find this post useful. If you have questions or want to share your own advice, leave a comment!

I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.

Arjun
I am Arjun from Hyderabad (India). I have been working as a software engineer from last 7+ years, and its my passion to learn new things and implement them as a practice. Aside from work, I likes gardening and spending time with pets.
DMCA.com Protection Status