title: Bootstrap-select - how to fire event on change
body: <p>I'm using Bootstrap 3.0.2 and the <a href="http://silviomoreto.github.io/bootstrap-select/" rel="noreferrer">Bootstrap-select</a> plugin.</p>
  
  <p><strong>Here's my select list</strong>:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;select class="selectpicker" data-live-search="true" data-size="7"&gt;
    &lt;option&gt;Petr Karel&lt;/option&gt;
    &lt;option&gt;Honza Novák&lt;/option&gt;
    &lt;option&gt;David Egydy&lt;/option&gt;
    &lt;option&gt;Sláva Kovář&lt;/option&gt;
    &lt;option&gt;Hana Skalická&lt;/option&gt;
    &lt;option&gt;Simona Kolářová&lt;/option&gt;
    &lt;option&gt;Kateřina Sychová&lt;/option&gt;
    &lt;option&gt;Amálka Sychová&lt;/option&gt;
    &lt;option&gt;Jana Sychová&lt;/option&gt;
    &lt;option&gt;Magdaléna Sychová&lt;/option&gt;
    &lt;option&gt;Tereza Sychová&lt;/option&gt;
    &lt;option&gt;Bohdana Sychová&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p><strong>Here's my JavaScript</strong>:</p>
  
  <pre class="lang-js prettyprint-override"><code>//inicialization of select picker
  $('.selectpicker').selectpicker();
  
  //on change function i need to control selected value
  $('select.selectpicker').on('change', function(){
     var selected = $('.selectpicker option:selected').val();
     alert(selected);
  });
  </code></pre>
  
  <h3>Issue</h3>
  
  <p>My problem is that change function won't work. It doesn't do anything, and I can't find solution by myself.</p>
  
  <p>If i put it into document ready instead change function it seems to be working. So i guess i have mistake somewhere in: </p>
  
  <pre><code>$('select.selectpicker').on('change', function(){
  </code></pre>
  
  <p>I also tried to use only: </p>
  
  <pre><code>$('.selectpicker').on('change', function(){
  </code></pre>
  
  <p>without this select prefix but nothing changes.</p>
  
  <h3>UPDATE</h3>
  
  <p>Solution is putting jquery code into <code>document.ready()</code>. Thanks to <a href="https://stackoverflow.com/users/3852595/kartikeya">Kartikeya</a></p>