I'm currently trying to get the values of checked checkboxes. These checkboxes have unique IDs because they are defined on a modal box.
<input type = 'checkbox' id = 'audience_Name-$row[asset_ID]' value = 'SMB'> SMB
<input type = 'checkbox' id = 'audience_Name-$row[asset_ID]' value = 'SMB'> SMB
<input type = 'checkbox' id = 'audience_Name-$row[asset_ID]' value = 'SMB'> SMB
<input type = 'checkbox' id = 'audience_Name-$row[asset_ID]' value = 'SMB'> SMB
<input type = 'checkbox' id = 'audience_Name-$row[asset_ID]' value = 'SMB'> SMB
<input type = 'button' id = 'editAssetColumn' value = 'Submit'>
And here, I'm testing if I'm retrieving them but unfortunately, I cannot.
$("button#editAssetColumn").click( function() {
var edit_id = $(this).attr('id');
var name = $("input#audience_Name:checked-"+edit_id).val();
$('input#audience_Name:checked-'+edit_id).each(function() {
alert("Success!");
});
});
I believe it's the syntax... Thanks in advance!
this.id>$(this).attr("id");. Also, don't usealert()as a debugging tool.console.log()is made just for that.