title: Copy value from datepicker and set focus
body: <p>I have two inputs with datepicker. I want that, when I choose a date on one, it is copied on the other and sets the focus on it. The code below works but after choosing a date in the first datepicker, the focus is on the second input but the datepicker opens and closes immediately.. How can I keep it opened ?</p>
  
  <p>I have tried using <code>event.preventDefault()</code> but it did not work. I may not have used it correctly.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function copierDateDebutPourDateFin(elementId, elementValue) {
    $("#" + elementId.substring(0, elementId.length - 3) + "fin").val(elementValue);
    $("#" + elementId.substring(0, elementId.length - 3) + "fin").focus();
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;input type="text" class="form-control" name="date_liv_deb" id="date_liv_deb" placeholder="Date"  onchange="copierDateDebutPourDateFin(this.id, this.value);" /&gt;
  &lt;input type="text" class="form-control" name="date_chg_fin" id="date_chg_fin" placeholder="Date"  /&gt;</code></pre>
  </div>
  </div>
  </p>