jQuery UI Plugin to append dialogs to form tag in ASP.NET
How would I make a jQuery plugin that does the following:
var login = $("#login-dialog");
login
开发者_运维百科 .dialog({ autoOpen: false })
.parent(".ui-dialog")
.appendTo("form");
but returns the same as .dialog would return (that is, $("#login-dialog")
again)
so I could use
login.dialogForm({ autoOpen: false})
and still keep chaining for example...
login
.dialogForm({ autoOpen: false})
.find("input:submit, button, a")
.button()
Wasn't that hard:
(function ($) {
$.fn.dialogForm = function (opts) {
this.dialog(opts)
.parent(".ui-dialog")
.appendTo("form");
return this;
};
})($);
精彩评论