user3797879 user3797879 - 5 months ago 32
jQuery Question

Java script how to make a confirm dialog?

I am writting app using Django. I don't want to make a new template, but I want to make sure if user really want to delete this element.

I just use href to go to view, delete element and I then go back do the current one. Is there any simple way to do this dialog or should I do everything with Django?

I am using this code to redirect to delete element.

<td><a class="button icon remove" href="delete/{{ item.id }}" role="button" value={{ item.id }}>Delete</a>

Answer

You can use Bootbox.js. It gives you nice bootstrap message boxes, i.e alert, confirm and prompt.

Sample code:

bootbox.confirm("Are you sure?", function(result) {
  Example.show("Confirm result: "+result);
}); 
Comments