I need to confirm deletion using Bootstrap 3 modal box (YES/NO). How can I create this?
HTML code:
<form action ="<?php echo $URL .'/admin/privileges.php?action=editable' ?>" method="POST">
<button class='btn btn-danger btn-xs' type="submit" name="remove_levels" value="delete">
<span class="fa fa-times"></span> Delete
</button>
</form>
simple way to use modals is with eModal!
Ex from github:
<script src="//rawgit.com/saribe/eModal/master/dist/eModal.min.js"></script>
Tip: You can use change the default label name! { label: 'Yes' | 'True'| 'OK' }
Following solution is better than bootbox.js, because
digimango.messagebox.js:
To use digimango.messagebox.js:
FIDDLE
For your button:
You can use
Bootbox
dialog boxesPlunker Demo
You need the modal in your HTML. When the delete button is clicked it popup the modal. It's also important to prevent the click of that button from submitting the form. When the confirmation is clicked the form will submit.
Create modal dialog in HTML with id="confirmation" and use function showConfirmation.
Also remember you should to unbind (modal.unbind()) cancel and success buttons after hide modal dialog. If you do not make this you will get double binding. For example: if you open dialog once and press 'Cancel' and then open dialog in second time and press 'Ok' you will get 2 executions of success callback.
https://jsfiddle.net/yiiBoy/hne9sp6g/