I figured out how to show them as an alert, but I would like to list them below the checkboxes:
http://jsfiddle.net/UqrYJ/203/
Code:<input type="checkbox" id="1"> <label>First</label><br> <input type="checkbox" id="2"> <label>Second</label><br> <input type="checkbox" id="3"> <label>Third</label><br> <input type="checkbox" id="4"> <label>Forth</label>Code:$("input:checkbox").change(function() { var someObj = {}; someObj.showid = []; $("input:checkbox").each(function() { if ($(this).is(":checked")) { someObj.showid.push($(this).attr("id")); } }); alert(someObj.showid); });
Bookmarks