Home How to set the value to today of a week input
Reply: 3

How to set the value to today of a week input

Bram
1#
Bram Published in 2017-09-14 08:53:07Z

Basically if I typed

<input type="week">

What do I type to set the default value to today's week?

user3888958
2#
user3888958 Reply to 2017-09-14 10:08:48Z

Link http://w3c.github.io/html-reference/input.week.html will have all the details regarding input type="week".

 <input type="week" name="year_week" value="2017-W42">
Rashid Khan
3#
Rashid Khan Reply to 2017-09-14 09:50:51Z

You can do as below:

<input type="week" name="year_weeks" value="2017-W20">

For More info please click here HTML5 input type=week

See example here

It will work on latest chrome & IE browser.

Bram
4#
Bram Reply to 2017-09-15 08:38:48Z

I fixed it by the following if anyone else had problems with this like me, which I don't expect since people just down vote beginners who have trouble with finding solutions appearently.

<input type="week" value="<?php echo date('Y').'-W'.date('W');?>">

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.30305 second(s) , Gzip On .

© 2016 Powered by cudou.com design MATCHINFO