0

I am making a custom alert from this url . http://coding.abel.nu/2012/01/jquery-ui-replacement-for-alert/ I am able to make simple alert .But I need to do some work on "ok" button , use callback function.I got the error "undefined not function" .here is my fiddle http://jsfiddle.net/uV2Nv/

 $.extend({
        confirm: function(message, title, okAction) {
            $("").dialog({
                // Remove the closing 'X' from the dialog
                open: function(event, ui) { $(".ui-dialog-titlebar-close").hide(); }, 
                buttons: {
                    "Ok": function() {
                        $(this).dialog("close");
                        okAction();
                    },
                    "Cancel": function() {
                        $(this).dialog("close");
                    }
                },
                close: function(event, ui) { $(this).remove(); },
                resizable: false,
                title: title,
                modal: true
            }).text(message);
        }
    });

    function okAction(){
     alert('--')   
    }
    $.alert("message", "title",okAction)
Shruti
  • 1,554
  • 8
  • 29
  • 66
  • that error is coming from `$.alert("message", "title", okAction)` There is no such function `.alert()` – Adjit Jun 02 '14 at 15:00
  • @Adjit link written that it call $.extend({ function – Shruti Jun 02 '14 at 15:02
  • it sounds like you want to be calling `$.confirm("message", "title", okAction)` – Adjit Jun 02 '14 at 15:05
  • Why don't use alert("Your alert"); ? here some precisions [http://stackoverflow.com/questions/3616181/callback-function-meaning][1] [1]: http://stackoverflow.com/questions/3616181/callback-function-meaning – Kirgan Jun 02 '14 at 15:07
  • actually I am making custom alert.to remove tittle of alert "javascript" – Shruti Jun 02 '14 at 15:08
  • @Adjit not working on my side ..can you check on your side – Shruti Jun 02 '14 at 15:09
  • 2
    change `$.alert` to `$.confirm` and give the dialog a div to use (`$("
    ").dialog`)
    – ioums Jun 02 '14 at 15:11

0 Answers0