Firstly, I am not interested in using javascript confirm for this purpose. Please read on. For example, adding an onClick attribute to each link with a function that triggers a system dialog box is not what I want.
Instead of the standard system dialog box, I have implemented bootstrap's dialog box.
Here are several delete buttons for different items:
<a href="www.mysite.com/product/1" data-target="#myModal" data-toggle="modal"><i class="icon-remove"></i> Delete</a>
<a href="www.mysite.com/product/2" data-target="#myModal" data-toggle="modal"><i class="icon-remove"></i> Delete</a>
<a href="www.mysite.com/product/3" data-target="#myModal" data-toggle="modal"><i class="icon-remove"></i> Delete</a>
Below is the code for displaying the modal using Bootstrap:
<div class="modal small hide fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">Confirm Delete ?</h3>
</div>
<div class="modal-body">
<p class="error-text"><i class="icon-warning-sign modal-icon"></i>Are you sure you want to Delete the Category and all its associated Properties?</p>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Cancel</button>
<button class="btn btn-danger" data-dismiss="modal">Delete</button>
</div>
</div>
The dialog box is working correctly, but after clicking the delete button in the dialog box, it does not redirect to the corresponding page of the links above. The modal simply disappears without redirection.