JSFiddle - React, Tailwind, and code Playground

by farhatdz

HTML

<input type="date" name="bday" id="datePicker">
<input type="button" value="date" id="datebtn">
<p class="getDate"></p>

JavaScript

$(document).ready( function() {
    let now = new Date();
 
    let day = ("0" + now.getDate()).slice(-2);
    let month = ("0" + (now.getMonth() + 1)).slice(-2);

    let today = (day)+"-"+(month)+"-"+ now.getFullYear();


   $('#datePicker').val(today);
    
    $('#datebtn').click(function(){
        
        testClicked();
        
    });
});
function testClicked()
{
  $('.getDate').html($('#datePicker').val());
}