I want to get the id of the multiple selected check boxes
HTML:
<input type="checkbox" class="a" id="1">1
<input type="checkbox" class="a" id="2">2
<input type="checkbox" class="a" id="3">3
<input type="checkbox" class="a" id="4">4
<input type="checkbox" class="a" id="5">5
<input type="button" value="Button" id="button">
JS:
$("#button").live('click',function(){
var a = document.getElementsByClassName("a");
alert(a);
alert(a.checked);
});
I’m not sure why everyone is posting code to check the boxes?
To do that, use this code:
Example fiddle
You should also not use
live().delegate()oron()are the better solutions, but they are only required should the#buttonelement be added to the page after page load.