I have multiple checkboxes in a for each loop all with different data attributes.
<input data-pid="<?php echo $name ?>" class="live" name="live" id="live" type="checkbox" value="">
In JQuery I am trying to fetch the data attribute of the checked option and whether it is checked or not.
$(".live").click(function() {
var n = this.id
var a = this.attr("data-pid");
I don't seem to be able to get the id or attr
this.checkedto see if it is checked or notvar a = this.attr("data-pid");tovar a = $(this).attr("data-pid");