title: Initialize plugin in self-invoking function in JavaScript
body: <p>I'm trying to set up a pagination on my website and I found a JavaScript plugin to do this.</p>
  
  <p>I need to initalize plugin in self-invoking function, like this:</p>
  
  <pre><code>$(function(){
  
      $('#pagination').twbsPagination({
          visiblePages: 3,
          totalPages: 10,
          prev: '&lt;&lt;',
          next: '&gt;&gt;',
          first: '',
          last: '',
          pageClass: 'page-item page-item-w',
          onPageClick: function (event, page){
              ..............
          }
      });
  
  });
  </code></pre>
  
  <p>But an error appears in console:</p>
  
  <pre><code>TypeError: $(...).twbsPagination is not a function
  </code></pre>
  
  <p>When I put initialization outside from self-invoke function than It works:</p>
  
  <pre><code>$('#pagination').twbsPagination({
      visiblePages: 3,
      totalPages: 10,
      prev: '&lt;&lt;',
      next: '&gt;&gt;',
      first: '',
      last: '',
      pageClass: 'page-item page-item-w',
      onPageClick: function (event, page){
          ..............
      }
  });
  
  $(function(){
  
      // ............
  
  });
  </code></pre>
  
  <p>How to initalize this in self-invoking function?</p>