Pass 'this' element into dialog

Pass 'this' element into dialog

When the user clicks "Continue" on this dialog, how can I get it to complete the rest of the function in the click event?  I realize it needs to be moved into the function for the continue button, but how do I do that and retain "this" in the click event?

  1.        $("#confirm").dialog({
               autoOpen: false,
            modal: true,
               width: 400,
               title: 'Are You Sure?',
            overlay: {
                opacity: 0.5,
                background: "black"
            },
            buttons: [
                {
                    text: "Cancel",
                    click: function() { $(this).dialog("close"); }
                },
                {
                    text: "Continue",
                    click: function() {
                        $(this).dialog("close"); }
                }           
                ],
               zIndex: 5000
           });

        $("#firstcol input").click(function() {






















  2.         $("#confirm").dialog("open");
          //do this following only if Continue in dialog is clicked  

  3.          $(this).remove();
        });