I am using stephanwagner jBox to accomplish the following task.
I have a list link like:
<a href="#" rel="first" class="delete">Delete First</a>
<a href="#" rel="second" class="delete">Delete Second</a>
<a href="#" rel="third" class="delete">Delete Third</a>
<a href="#" rel="fourth" class="delete">Delete Fourth</a>
I am targeting these elements. On clicking them, shows me a confirmation to make sure if really want to delete something. But now matter which link I click, it always picks the first element in a row. I am using confirm
with a callback function when pressed ok/yes.
Problem is, I am not able to get the currently clicked element. I used $(this)
, still not working. I think inside jBox, this refers to jBox itself.
Below is how I started
new jBox('Confirm',{
attach: $('.delete'),
title: 'Confirmation dialogue box',
content: 'Do you want to continue?'
confirm: function(){
$.ajax({
url: 'delete-file',
data:{
'path': $(this).attr('rel') // It obviously didnt work as it is always selecting the first element in a row.
}
});
},
cancel: function(){
}
});