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
Written by Yesi D
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Jquery
Authors
Related Tags
#jquery
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#