I want to extract data from data- tags within multiple class elements. Is the each() function the best way to do this?
Jquery:
$('#copymodal').on('show.bs.modal', function (event) {
$(".copy19").each(function(){
var a = data('total');
alert(a);
});
})
HTML:
<a class='copy19' href='#'
data-statementid="14"
data-total="98078"
data-toggle="modal"
data-target="#editmodal">
Edit
</a>
<a class='copy19' href='#'
data-statementid="16"
data-total="78078"
data-toggle="modal"
data-target="#editmodal">
Edit
</a>