How do you disable the datepicker in Microsoft Edge?

后端 未结 4 1668
走了就别回头了
走了就别回头了 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:09

    The input type must be text and not date. This...

    <input type="date" />
    

    Should be

    <input type="text" />
    

    Otherwise Chrome and Edge will add a datepicker. Instead use a class or id to identify it as datepicker and do something like $(".datepicker").datepicker();

    0 讨论(0)
  • 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.

    0 讨论(0)
  • 2021-02-08 03:20

    As with Cyptic I had to change the type to text

    <input type="text" class="datepicker"/>
    

    And then in JQuery

    $("input.datepicker:text").datepicker({
        showOn: "both",
        dateFormat: "dd MM yy",
        changeMonth: true,
        changeYear: true
    });
    
    0 讨论(0)
  • 2021-02-08 03:20

    if your is iranian please visit this page

    and change the type to text

    <input type="text" id="datepicker"/>
    

    and in jQuery

    $("#datepicker").kamaDatepicker('BirthDate-ID');
    
    0 讨论(0)
提交回复
热议问题