How to Get Selected Checkbox Value Using jQuery

In this tutorial, learn how to get selected checkbox value using jQuery. Get single select or multiple selected checkbox value with jQuery. The multiple checkboxes give an array as multiple selected value.

The single selected checkbox gives permission to select the only single checkbox. However, multiple select checkboxes allow selecting multiple checkboxes from the list.

Get Single Selected Checkbox Value Using jQuery

The checkbox does not allow users to select only one checkbox. You can select multiple checkboxes from the list. However, to restrict users for multiple select, you have to use jQuery.

Radio buttons by default if you give same name convention to each list items. Radion button will give you the functionality to select only single selection without using any script. You may also like to read
how to get selected radio button value using jQuery

Below is the script you can use to restrict multiple selections for the checkbox. You can also use below code to select a single checkbox and get the single value.

Output

Virat Kohli
Chris Gayle
Mahendra Singh Dhoni
Sachin Tendulkar
Donald Bradman

Click the checkbox given above or click each checkbox. You will get a single selection only and get single value on each selection.

Get Multiple Selected Checkbox Value Using jQuery

In addition to the above example, you can also get value for multiple selections. To get value for the multiple selections, you have to check each selection if checked. You have to create an array variable and push each checked checkbox to this variable.

Get multiple selected checkbox value in an array format using jQuery join function.

Output

Virat Kohli
Chris Gayle
Mahendra Singh Dhoni
Sachin Tendulkar
Donald Bradman

Click multiple check boxes to get value on click of the button given above. The array can be useful to get multiple selection values and get user input form data.

You may also like to read.

Hope, you like this tutorial of how to get selected checkbox value using jQuery. If you have any query regarding the tutorial, please comment below.

Also tell me, which method are you using to get selected checkbox value using jQuery

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.