Computer >> Computer tutorials >  >> Programming >> HTML

How to use week input type in HTML?


The week input type is used in HTML using the <input type="week">. Using this, allow users to select a week and year.

A date picker popup is visible whenever you will give a user input to the week input type.

Note − The input type week is not supported in Firefox and Internet Explorer. It works on Google Chrome.

How to use week input type in HTML?

You can try to run the following code to learn how to use week input type in HTML. It will show both week and year.

Example

<!DOCTYPE html>
<html>
   <head>
      <title>HTML input week</title>
   </head>

   <body>
      <form action = "" method = "get">
         Details:<br><br>
         Student Name<br><input type = "name" name = "sname"><br>
         Training week<br><input type = "week" name = "week"><br>
         <input type = "submit" value = "Submit">
      </form>
   </body>
   
</html>