Last active
April 16, 2016 18:07
-
-
Save omalave/889de805073939907cd60a49d48f5988 to your computer and use it in GitHub Desktop.
fill a input field with current date
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function(){ | |
var fullDate = new Date(); | |
var twoDigitMonth = (fullDate.getMonth()+1)+"";if(twoDigitMonth.length==1) twoDigitMonth="0" +twoDigitMonth; | |
var twoDigitDate = fullDate.getDate()+"";if(twoDigitDate.length==1) twoDigitDate="0" +twoDigitDate; | |
var currentDate = twoDigitDate + "/" + twoDigitMonth + "/" + fullDate.getFullYear(); | |
$("#datepicker").val(currentDate); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment