Bootstrap-Confirmation
Bootstrap-Confirmation copied to clipboard
Unable to get data-id value
Hi,
I am using bootstrap confirmation in Meteor.JS App
Here is my code:
HTML
There is a loop which fetch the data from DB
{{#each FetchRecords}}
<tr>
<td><a href="#" data-id="1" class="edit">{{name}}</a></td>
<td>{{order_id}}</td>
<td><a class="btn confirmation" id="delete" data-toggle="confirmation" data-id="{{_id}}" data-placement="right" data-original-title="" title="">Delete</a></td>
</tr>
{{/each}}
JS:
$('[data-toggle="confirmation"]').confirmation({onConfirm: function(){
console.log($(this).data("id"));
}});
I am unable to get the data-id value, its saying undefined. Could you please tell me how to fetch the data-id value when the confirm button is clicked.
Thanks and Best Regards, Manu
did you solved that? i have this problem too
I get the value from href property
javascript
$('[data-toggle="element-confirm"]').confirmation({
title:"Some question?"
,btnOkLabel:"YES"
,btnCancelLabel:"NO"
,onConfirm: function (obj) {
var valueOfHref = obj.currentTarget.href.split('/').pop()
console.log(valueOfHref );
$(".tracking .icon_td .popover").find('.popover-content').html("Cambiando...");
alert("waiting...");
$('[data-toggle="solicitud-estado-confirm"]').confirmation('hide');
return false;
}
});//confirmation
html
<a data-href="1" href="1" data-singleton="true" data-popout="true" class="btn btn-ms btn-primary" data-toggle="element-confirm">Click 1</a>
<a data-href="2" href="2" data-singleton="true" data-popout="true" class="btn btn-ms btn-primary" data-toggle="element-confirm">Click 2</a>
<a data-href="3" href="3" data-singleton="true" data-popout="true" class="btn btn-ms btn-primary" data-toggle="element-confirm">Click 3</a>