0

I want to use <input type="week"> and <input type="month">.

My problem is that those type values are currently supported only by webkit browsers, and others fall back to type=text". I need them to fall back to type="date".

Is there a javascript method to check if an attribute value is supported by the browser?

  • 1
    "To detect whether the browser supports , we create a new element, try setting its type to week, then immediately check what its type is set to. Non-supporting browsers will return text, because the week type falls back to type text." ([ examples](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/week#examples)) – showdev Nov 17 '22 at 08:55
  • This should help you https://stackoverflow.com/questions/18625321/detect-webkit-browser-in-javascript#:~:text=In%20order%20to%20know%20if,test(navigator. – rrr63 Nov 17 '22 at 08:56

0 Answers0