HTML5 date picker doesn't show on Safari

前端 未结 6 1867
星月不相逢
星月不相逢 2021-02-02 05:13

Having previously used jQuery date picker, I have now converted some of the date fields in forms on my website to the HTML5 date picker.

On the documentation, it says Sa

6条回答
  •  再見小時候
    2021-02-02 06:01

    Although there is no native datepicker for Safari (or IE) a pretty good workaround is to add a placeholder attribute to the date input. This informs Safari and IE users which format the fallback text input should be (which is yyyy-mm-dd).

    The placeholder doesn't display on browsers that support type="date" so this workaround won't affect other browsers.

    e.g.

提交回复
热议问题