Chrome type=“date” and jquery ui date picker clashing

前端 未结 6 742
再見小時候
再見小時候 2020-12-15 08:06

I have a input box having type=\"date\", everything works fine in IE but in latest version of Chrome it comes with a spinner, Down arrow and with a placeholder of mm/dd/yyyy

6条回答
  •  清歌不尽
    2020-12-15 08:35

    Google offered another way to resolve this conflict that I found helpful, at the bottom of this post.

    var isDateInputSupported = function(){
      var elem = document.createElement('input');
      elem.setAttribute('type','date');
      elem.value = 'foo';
      return (elem.type == 'date' && elem.value != 'foo');
    }
    
    if (!isDateInputSupported())  // or.. !Modernizr.inputtypes.date
      $('input[type="date"]').datepicker();
    

提交回复
热议问题