How can I preset the value in datetime input to current date and time using php or javascript?
<input type="datetime-local" name="followupon">
What I have..
What I want...
How can I preset the value in datetime input to current date and time using php or javascript?
<input type="datetime-local" name="followupon">
What I have..
What I want...
Share Improve this question edited Oct 27, 2017 at 10:06 Shujaat Shaikh asked Oct 27, 2017 at 9:13 Shujaat ShaikhShujaat Shaikh 2991 gold badge6 silver badges19 bronze badges1 Answer
Reset to default 6Well.. You can just set the value by using the "value" attribute:
<input type="datetime-local" name="followupon" value="2014-01-02T11:42:13.510">
See https://developer.mozilla/en-US/docs/Web/HTML/Element/input/datetime-local#Value for more information
If you want to use the current date, you can use php like so:
<input type="datetime-local" name="followupon" value=<?php echo date('Y-m-d\TH:i:s'); ?>">
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745340149a4623288.html
评论列表(0条)