Is there a way to get the data attribute using magnific popup? I have a for loop statement, and to get the id for each data i added the data-item attribute.
<?php foreach ($showItems as $items) { ?>
<tr>
<td><?php if(!empty($items['ItemCode'])) echo $items['ItemCode'], ' '; ?><input type="hidden" name="pid" id="pid" value="<?php echo $items['ItemCode']; ?>" /></td>
<td><img src="" /></td>
<td><?php if(!empty($items['Name'])) echo $items['Name'], ' '; ?></td>
<td><?php if(!empty($items['Price'])) echo $items['Price'], ' '; ?></td>
td><?php if(!empty($items['Description'])) echo $items['Description'], ' '; ?></td>
<td><input type="text" name="qty" id="qty" maxlength="3" size="2" /></td>
<td ><a class="popup-modal" href="#test-modal" data-item="111" >Add To Registry</a></td>
</tr>
<?php } ?>
i test to get the item using the alert function once magnific popup triggered.
$('.popup-modal').magnificPopup({
preloader: true,
callbacks : {
open : function(){
var self = $(this);
var id = self.data('item');
alert(id);
// });
}