JSFiddle - React, Tailwind, and code Playground
HTML
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/ui-lightness/jquery-ui.css">
<div id="popup">I'm a popup</div>
JavaScript
(function ($) {
$.fn.dialogPlugin = function (options, name, val) {
if (options == "option") {
if (val == undefined)
return $(this).dialog("option", name);
else
return $(this).dialog("option", name, val);
}
var optionsForJQuery = $.extend({}, options);
optionsForJQuery.close = function() {
alert("This is plugin's close behavior");
options.close();
};
$(this).dialog(optionsForJQuery);
return $(this);
};
})(jQuery);
$("#popup").dialogPlugin({
close: function() {
alert("This is user's first close behavior");
}
});
$("#popup").dialogPlugin("option", "close", function() {
alert("This is user's second close behavior");
});