HTML 5 - Input type date formatting on iOS

后端 未结 4 739
一生所求
一生所求 2021-01-06 03:30

I am using an HTML 5 form on an iPhone. This form has an input element like the following:


W

4条回答
  •  轮回少年
    2021-01-06 04:08

    I agree with @PorneL's answer, however, you can potentially do some work to simulate the results you want. I will stipulate that it's not the best way to do it.

    In pseudo code:

    • Have two inputs, one of type date and another of text.
    • Make the date input either invisible or 1px x 1px in side, and make the input the size that of the date that you would like
    • On focus on the text input, set focus on the adjacent date input automatically.
    • At this point, the user will be editing the date input field
    • On change of the date field, grab the value and insert it into the text field using whatever formatting you prefer.

    Again, it may not be the best solution, but it can work this way.

提交回复
热议问题