1

I want to override jQueryUI dialog widget inner method. In this example it is only adding "console.log('button');" to the original function
This is my code:

$.extend($.ui.dialog.prototype, 
    {   
        _createButtons: function() {
            console.log('button');
            var e = this, i = this.options.buttons;
            return this.uiDialogButtonPane.remove(), this.uiButtonSet.empty(), t.isEmptyObject(i) || t.isArray(i) && !i.length ? (this.uiDialog.removeClass("ui-dialog-buttons"), undefined) : (t.each(i, function(i, s) {
                var n, a;
                s = t.isFunction(s) ? {click: s,text: i} : s, s = t.extend({type: "button"}, s), n = s.click, s.click = function() {
                    n.apply(e.element[0], arguments)
                }, a = {icons: s.icons,text: s.showText}, delete s.icons, delete s.showText, t("<button></button>", s).button(a).appendTo(e.uiButtonSet)
            }), this.uiDialog.addClass("ui-dialog-buttons"), this.uiDialogButtonPane.appendTo(this.uiDialog), undefined)
        }
    }
);

I get this error: "Uncaught ReferenceError: t is not defined"
What is wrong here? Or what is the proper way to do the task?

lvil
  • 4,326
  • 9
  • 48
  • 76
  • I'm not sure what the question is since the error message is so clear. At no point in that code is `t` either declared or populated. And I don't see how it will work with a return statement with multiple values, comma separated. – Reinstate Monica Cellio Nov 13 '13 at 13:26
  • "t" is defined in the "dialog" itselt. About the return statement: http://stackoverflow.com/questions/10284536/return-statement-with-multiple-comma-seperated-values – lvil Nov 13 '13 at 13:28
  • Thanks for the explanation. I know now to never use that type of return statement :p Good luck with your issue. – Reinstate Monica Cellio Nov 13 '13 at 13:42

1 Answers1

0

So, it was simple: inside the jquery_ui.js t is used for jQuery

var t = $;
lvil
  • 4,326
  • 9
  • 48
  • 76