Hi guys i'm currently working on a delete validate function in javascript. Here is my code.
function confirmDelete(){
var agree = confirm("Are you sure you want to delete this file?");
if(agree == true){
return true
}
else{
return false;
}
}
The alert dialog box comes out but whenever i press "Cancel" button it still deletes the file in the table
Here is my HTML:
<a href=".base_url()."main/delete?id=$row->id>"."<i class='icon-trash' rel = 'tooltip' title = 'Delete' id = 'delete' onClick = 'confirmDelete();'></i></a>";
I'm using CodeIgniter by the way any help will much be appreciated! Thanks guys! :)