Getting IDs and VALUES of all selected checkboxes using jQuery.

Vishalneeraj-24503
Posted by Vishalneeraj-24503 under jQuery category on | Points: 40 | Views : 174
<input type = "checkbox" id = "Checkbox1" value = "1" />
<input type = "checkbox" id = "Checkbox2" value = "2" />
<input type = "checkbox" id = "Checkbox3" value = "3" />
<input type = "checkbox" id = "Checkbox4" value = "4" />
<input type = "button" id = "btn" value = "Check" />

<script type = "text/javascript" src = "http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.6.1.min.js"></script>
<script type="text/javascript">
$("#demo").live("click", function () {
$("input:checkbox:checked").each(function () {
alert("Id: " + $(this).attr("id") + " Value: " + $(this).val());
});
});
</script>

Comments or Responses

Login to post response