I know that I can create custom jQuery plugins by using the $.fn.myFunction constructor, and the calling the custom function in JavaScript as $(\'selector
$.fn.myFunction
$(\'selector
(function ($) { $.MessageBox = function () { var show = function () { // something... } var hide = function () { // something... } return { show: show, hide: hide } } })(Jquery);
I think you better scope to Immediate invocation function to avoid collision with namespaces.