Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 12. jQuery Plugins > Including Private Functions in Your Plugin

12.7. Including Private Functions in Your Plugin

12.7.1. Problem

Your plugin code is growing and needs to be organized. How can you implement a private method that’s unavailable to code outside your plugin?

12.7.2. Solution

By utilizing the plugin design pattern started in Section 12.5, private functions may be defined normally within the anonymous function that we’ve wrapped our plugin in. Because the function is enclosed in an anonymous function, outside code won’t see our private method. Code outside will only be able to see functions or methods that are attached to the jQuery object.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial