SO - 18943084

by Arun P Johny

HTML

<link rel="stylesheet" href="http://jquery.eiremedia.netdna-cdn.com/plugins/modals-lightboxes/zebra-dialog/public/css/zebra_dialog.css">
<script src="http://jquery.eiremedia.netdna-cdn.com/plugins/modals-lightboxes/zebra-dialog/public/javascript/zebra_dialog.js"></script>
<table>
    <tr>
        <td>Example1</td>
        <td><a class="delete" href="#">Delete</a>

        </td>
    </tr>
    <tr>
        <td>Example1</td>
        <td><a class="delete" href="#">Delete</a>

        </td>
    </tr>
    <tr>
        <td>Example1</td>
        <td><a class="delete" href="#">Delete</a>

        </td>
    </tr>
</table>

JavaScript

$(document).ready(function () {
    $(".delete").bind("click", function (e) {
        e.preventDefault();
        var $this = $(this);
        $.Zebra_Dialog("Do you want to delete?", {
            type: "question",
            title: "Question",
            buttons: ['Delete', 'Cancel'],
            onClose: function (caption) {
                if (caption == 'Delete') {
                    $this.closest('tr').remove();
                    //code required to delete the record from server goes in here
                }
            }
        })
    });
});