Get selected checkbox’s value using jQuery

This tutorial shows how we can get currently selected checkbox’s value using jQuery. We can easily use the power of jQuery to check which checkbox is selected using is(“:checked”) and get the selected checkbox’s value using $(‘[name=”checkbox name”]:checked’).val(). Here we will get the selected value when a checkbox is clicked, so jQuery’s click() function is used for capturing onclick event.


Knowledge of HTML and jQuery
Final Output

Get selected checkbox value using jQuery

Now we will see how we can make this happen step by step

Step 1. Create an HTML file anywhere in your computer disk space.

Step 2. Write the below code inside <body></body> tag. Below code renders the checkboxes on the browser when the HTML file is run.

Step 3. Now include the jQuery library from CDN inside the <head></head> tag

Step 4. Write below code for getting selected checkbox’s value when clicked on a checkbox

Step 5. Putting all together, the entire HTML file

Step 6. Now run the above HTML file and check the checkbox.

That’s all. Thank you for reading.

Soumitra Roy Sarkar

I am a professional Web developer, Enterprise Application developer, Software Engineer and Blogger. Connect me on Twitter Facebook  Google Plus Linkedin

Leave a Reply

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