Creating custom jQuery function without selector prerequisite

后端 未结 3 1434
天涯浪人
天涯浪人 2020-12-30 06:00

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

3条回答
  •  心在旅途
    2020-12-30 06:27

    This should work:

    jQuery.MessageBox = function() {
      var show = function() {
        // something...
      }
      var hide = function() {
        // something...
      }
      return {
        show: show,
        hide: hide
      }
    }
    

提交回复
热议问题