Last Updated: February 25, 2016
·
4.137K
· silvercorp

Get id of a checkbox

Javascript

$(document).ready(function(){
    $(":checkbox").change(function(){
        console.log(this.id, this.checked, this.name);
        //$.post("index.php", { id: this.id, checked: this.checked });
    });   
});

HTML

<input type="checkbox" id="check" name="1" />
<input type="checkbox" id="check" name="2" />
<input type="checkbox" id="check" name="3" />

JSFiddle

http://jsfiddle.net/silvercorp/9snGS/