How do you disable the datepicker in Microsoft Edge?

后端 未结 4 1669
走了就别回头了
走了就别回头了 2021-02-08 02:19

I have several inputs with type=\"date\" and want to disable the default date picker in Microsoft Edge since I\'m using jQuery\'s datepicker. How do I disable this using CSS or

4条回答
  •  南方客
    南方客 (楼主)
    2021-02-08 03:14

    It is not possible to disable the native datepicker control functionality in Edge (although Chrome can via a hack)- yet anyway.

    Input controls, unless designed by the browser are generally based on/are system controls. This means an input datepicker is an input datepicker, and a select drop down list is a select drop down list.

    Most controls are limited in customisation apart from basic styling like borders, padding and font styling, and HTML-standards attributes e.g. placeholder.

    You have a couple of options:

    Leave the default datepicker control as-is

    This is the option I will recommend. Sticking with the default system controls (+ styling where applicable) is usually the best policy. This ensures maximum device compatibility, and familiarity for your users. Plus, everything normally 'just works'.

    There is also less overhead in your JS code.

    Evil Option: Browser Detection

    You could detect if the browser is Edge in your JS code, and then tell it to render the jQuery control instead. You should avoid this unless you really need it, as browser detection becomes out-of-date and a maintenance nightmare pretty quick.

提交回复
热议问题