+ 2
How to take Month and Year as input ?
Hi! I can take input of month and year in separate input fields but I wants to take input of Month And Year using one input field. How can I achieve that ?? Can anyone please help me ??
15 Respuestas
+ 2
https://code.sololearn.com/Wfkg2e1FrvV6/?ref=app
It works here is the example
+ 1
<input type="month">
<input type="date" >
+ 1
"HTML input type="month"" https://www.w3schools.com/tags/att_input_type_month.asp
+ 1
Sasuke,
Perhaps in case of Firefox, which as you said (confirmed by HrCoder's link) month input is not supported; you can resort to using a simple <select> with option values representing month index. Pretty sure any browser supports that.
+ 1
Ipang
Thanks
Great suggestion
But how will I input year
+ 1
Sasuke,
As I see it, the date input is supported by Firefox. So there shouldn't be any problem right? besides, date input also supports the month value.
But in case there is a problem, I guess you can use number input, with additional validator, just to be sure the entered year wasn't a floating point value e.g. 2021.8 or the likes.
0
HrCoder
I have tried
But not working
It is just input type text
0
HrCoder
This is working here
But not in firefox
0
HrCoder
Sorry!
But I already told you that is not working in firefox
0
Sasuke that is what i want to say
Input type = month is not supported on Firefox
0
HrCoder
Thank you very much. I understand.
But do you now any other way to achieve that ?
Which work on all browsers
I will be grateful to you
0
<input type="date">
<input type="month">
<input type="year">
0
Hello
- 1
.