0

I am trying to create a function that will create an confirm delete message on any link or button with the class of "delete", inside a bootstrap modal. I currently have this code to create a regular confirm dialog:

'init_confirm_delete' : function(){
    $('a.delete,button.delete').live('click',function(e){
        return confirm('Are you sure you want to delete this?');
        e.preventDefault();
    });

},

That works fine. Below is my new code trying to integrate bootstrap UI:

    'init_confirm_delete' : function(){
    $('a.delete,button.delete').click(function () {
        $('#delete-confirm').dialog('open');
    return false;
});
    $("delete-confirm").dialog({
        autoOpen: false,
        modal: true,
        buttons: {
            Ok: function () {
                $(this).dialog("Delete");
            },
        }
    })      
},

Any ideas fellow coders?

0

1 Answer 1

1

I see a mistake and that is

$("delete-confirm").dialog({ ... }); // missing # for id selector

should be

$("#delete-confirm").dialog({ ... });
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.