I had a confirmation box that showed a confirmation alert when clicking on the delete button,
heres the function
<script type="text/javascript">
$('.confirm').on('click', function () {
return confirm('Are you sure you want to delete ?');
});
</script>
it was working fine whenever i put a class for any html element, until i added it inside this function it stopped working
$(document).ready(function() {
$('#list').dataTable({
"ajax":{
url :"list.php",
type: "GET",
error: function(){
$("#post_list_processing").css("display","none");
}
},
"columns": [
{ "data": "title" },
{ "data": "description" },
{
"data": function(item) {
return '<a class="confirm" href="delete.php?id=' + item.id + '">delete</i></a>';
}
}
]
});
});