Jump to content

Select all checkboxes in one click


Dharmender

Recommended Posts

Output the checkbox wherever you want it to be. Then attach some Javascript to its onclick so that all the name=customers[] checkboxes are checked.

 

Are you using any Javascript framework, like jQuery or whatever else is still popular these days that isn't jQuery?

Link to comment
Share on other sites

Output the checkbox wherever you want it to be. Then attach some Javascript to its onclick so that all the name=customers[] checkboxes are checked.

 

Are you using any Javascript framework, like jQuery or whatever else is still popular these days that isn't jQuery?

Using jquery.

Can I select all checkboxes using single click in Jquery. How can I get the values of all checkboxes in jquery for single click action

Edited by Dharmender
Link to comment
Share on other sites

Can I select all checkboxes using single click in Jquery.

Yes.

 

How can I get the values of all checkboxes in jquery for single click action

Do you actually want the values? They don't matter if all you want to do is select them.

 

Give this a shot yourself and see how far you get and we can help you fix any problems you come across. An easy method would be to use a selector to find all checkboxes, .each() over them, and make each one checked if it's named "customers[]".

Edited by requinix
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.