Inherit from jQuery UI dialog box and override call method

The simple code below describes my question (at least I want it that way):

$.widget("ui.mydialog", $.ui.dialog, { _create: function() { // How to call _create method of dialog? } }); 

I tried calling $.ui.dialog.prototype._create() from the above create method, but getting the following error in Firebug:

 this.element is undefined this.originalTitle = this.element.attr('title'); jquery...5667348 (line 5864) 

What else can you call this "super" method?

jQuery UI version 1.8.8

+6
javascript jquery override inheritance jquery-ui
source share
1 answer

I think I just found a solution ... $.ui.dialog.prototype._create.call(this);

Full code:

 $.widget("ui.ajaxdialog", $.ui.dialog, { _create: function() { // Your code before calling the overridden method. $.ui.dialog.prototype._create.call(this); // Your code after calling the overridden method. } }); 
+11
source share

All Articles