I want to pass value “345” by click on <a>
<a class="delete-button'" href="/Customer/Delete/345">Delete</a>
to this event.
How I can do it?
$(function () {
function Delete(event) {
myConfirm('Do you want to delete this record ?',
function () {
alert('You clicked OK'); // It should be 345 here
},
function () {
alert('You clicked Cancel');
},
'Confirm Delete');
return false;
}
$('a.delete-button').click(Delete);
});
Thank you!
I would do it by putting the “345” in a data attribute on your link tag:
<a class="delete-button" data-customer-id="345" href="/Customer/Delete/345">Delete</a>Then your delete function can reference it using the
.data()method, like so: