aspdotnet-suresh offers articles and tutorials,csharp dot net, articles and tutorials,VB.NET Articles,Gridview articles,code examples of 2.0 /3.5,AJAX,SQL Server Articles,examples of .net technologies

jQuery Get Checked / Selected Checkbox Values with Comma Separated List Based on Name

Jun 24, 2013

Here I will explain how to use jQuery to get checked / selected checkbox values with comma separated list based on name.


In previous articles I explained jQuery Get Set Delete Cookie example, jQuery Show gridview row details on mouseover, jQuery Create simple mobile website, jQuery clear textbox value on focus, jQuery Draggable & Resizable div with example and many articles relating to JQuery, JavaScript,, code snippets. Now I will explain how to get selected checkbox values with comma separated list based on name in jQuery.

Get selected checkbox values in jQuery

To get selected checkbox values based on name we need to write the code like as shown below

var slvals = []
$('input:checkbox[name=nameofyourcheckbox]:checked').each(function() {

If you want to see it in complete example check below code

<script type="text/javascript" src=""></script>
<script type="text/javascript">
$(function() {
$('#btnSubmit').click(function() {
var slvals = []
$('input:checkbox[name=chkcountry]:checked').each(function() {
alert('Selected Checkbox values are: ' + slvals)
<b>Sample checkbox inputs :</b>
<input type="checkbox" name="chkcountry" id="chkindia" value="India" />India
<input type="checkbox" name="chkcountry" id="chkusa" value="USA" />USA
<input type="checkbox" name="chkcountry" id="chkAustralia" value="Australia" />Australia
<input type="checkbox" name="chkcountry" id="chkMalaysia" value="Malaysia" />Malaysia
<button id="btnSubmit">Get Selected Values</button>
Live Demo

Sample checkbox inputs : India USA Australia Malaysia

If you enjoyed this post, please support the blog below. It's FREE!

Get the latest,, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email.

subscribe by rss Subscribe by RSS subscribe by email Subscribe by Email


sanju said...

This is very nice article, but within this example can u explain me how do i postback to codebehind either to json or javascript. your suggestion will be appreciated. Thank u :)

Azeem said...

Hi...Suresh this is very helpful...Great Job Man...Hats Off To You....Well Done Suresh

candyfredric said...

Nice... Post.. can you help in validation form for contact us page

Prathiparaj P said...

nice post suresh..

ramakrishna murthy Yeleswarapu said...
This comment has been removed by the author.
Francis said...

Suresh. Nice post. For more detailed validation controls Please check my blog.

Manjeet Singh said...

Nyc post dude

Give your Valuable Comments

Other Related Posts

© 2015 All Rights Reserved.
The content is copyrighted to Suresh Dasari and may not be reproduced on other websites without permission from the owner.