title: Datepicker onSelect
body: <p>I have an input [date_caisse] with class: datepicker-inline AND id: [date_caisse]</p>
  
  <p>I have this function initialized on all my web pages:</p>
  
  <pre><code>function InitEvents () {
  
  $('.datepicker-inline').datepicker({
  
      showButtonPanel: true,  /*added by oussama*/
      changeMonth: true, /*added by oussama*/
      changeYear: true, /*added by oussama*/
      firstDay: 1,
      dateFormat: 'yy-mm-dd',/*'dd/mm/yy'*/
      onSelect: function (dateText, inst) {
          //alert('select!');
          id = $(this).attr('id');
          parts = id.split('-');
          id2 = parts[parts.length -1];
          $('#datepicker-target-id-' + id2).val(dateText);
      }
  });
  </code></pre>
  
  <p>}</p>
  
  <p>I want to apply onSelect only on the current page, so this is what I did:</p>
  
  <pre><code>$('#date_caisse').datepicker({
  
      onSelect: function (dateText, inst) {
          alert('select!');
      }
  });
  </code></pre>
  
  <p>When I put  <em>alert('select!');</em> on the main js file (which is called in all pages) it works! but it doesn't when I try to trigger the action through the current file.</p>
  
  <p>Maybe, onSelect shouldn't be called twice.</p>
  
  <p>So, anyone could help me please?</p>
  
  <p><strong>Thanks and have a good day!</strong></p>