Currently facing a challenge with removing multiple href links that share the same ID. Here is a snippet of my code:
$('.delblk').click(function(e) {
e.preventDefault();
var id = $(this).attr('id').substr(7);
$.getJSON("../ajax_blocked.php?op=delete&id="+id, function(data) {
if (data) {
$("#delblk_"+id).each(function() {
$(this).remove();
});
}
});
This is how my HTML appears:
<a href="sent.php" id="delblk_7" class="delblk" ><span class="label label-important">Unblock</span></a>
<a href="sent.php" id="delblk_7" class="delblk" ><span class="label label-important">Unblock</span></a>
<a href="sent.php" id="delblk_8" class="delblk" ><span class="label label-important">Unblock</span></a>
The problem lies in it only removing the first href link and not both. What could I be overlooking?