i'm working on application have input field date.
changes daily, based on date data displayed.
i got solution problem in html5 input type date -- default value today? discussion .
but when tried code in intel xdk .its not displaying todays date . here code.
var date = new date(); var day = date.getdate(); var month = date.getmonth() + 1; var year = date.getfullyear(); if (month < 10) month = "0" + month; if (day < 10) day = "0" + day; var today = year + "-" + month + "-" + day; document.getelementbyid("thedate").value = today; <input type="date" id="thedate"> i have tried same code in project . gives result like
thanks in advance.....
moment.js helpful moment.js helped me. replies .. :)
- first import moment.js file code.
document.getelementbyid('today').value = moment().format('yyyy-mm-dd');- use above piece of code in separate function page gets automatically loaded.
thanks replies.
Comments
Post a Comment