title: Get today's day and month in 2 digit format on click
body: <p>I've got 3 date fields and a link to get today's date. It's all working fine but day and month default to single digits if less than 10, in FIREFOX. 1 September displays as 1 9 but I'd like it to display as 01 09. I have tried using jquery slice as explained in this post: <a href="https://stackoverflow.com/questions/6040515/how-do-i-get-month-and-date-of-javascript-in-2-digit-format">How do I get Month and Date of JavaScript in 2 digit format?</a></p>
  
  <p>But it is not working. Can someone point me in the right direction as to what I am doing wrong?</p>
  
  <p>My code:</p>
  
  <pre><code>&lt;div class="input-holder date-fields"&gt;
    &lt;input type="number" pattern="[0-9]*" inputmode="numeric" min="1" max="31" id="dd" class="dd" placeholder="DD" maxlength="2" /&gt;
    &lt;input type="number" pattern="[0-9]*" inputmode="numeric" min="1" max="12" id="mm" class="mm" placeholder="MM" maxlength="2" /&gt;
    &lt;input type="number" pattern="[0-9]*" inputmode="numeric" min="1900" id="yyyy" class="yyyy" placeholder="YYYY" maxlength="4" /&gt;
  &lt;a class="pick-today"&gt;Today&lt;/a&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>and jquery:</p>
  
  <pre><code>$("a.pick-today").on("click", function (event) {
      var now = new Date();
      var day = ("0" + now.getDate()).slice(-2);
      $(this).parent('.input-holder').find('input.dd').val(day);
  
      var now2 = new Date();
      var month = ("0" + (now2.getMonth() + 1)).slice(-2);
      $(this).parent('.input-holder').find('input.mm').val(month);
  
      var now3 = new Date();
      var year = now3.getFullYear();
      $(this).parent('.input-holder').find('input.yyyy').val(year);
  });
  </code></pre>
  
  <p><strong>fiddle: <a href="https://jsfiddle.net/82a6671r/" rel="nofollow noreferrer">https://jsfiddle.net/82a6671r/</a></strong></p>
  
  <p>UPDATE: it's working in Chrome but not in Firefox. Does anyone know why?</p>