我想删除工具提示标题,我使用下面的代码`$(“。picker__weekday”)。attr('title','');`但它只适用于打开日期选择器

时间:2017-02-20 10:08:08

标签: jquery html pickadate

image 1image 2

html代码是,

<div class="cols-3">
   <div class="input input--large label js-label">
      <label for="" id="start_date_lable" class="active">Insurance Start Date</label>
      <span class="icon-calendar" id='start_date_icon'></span>
      <input type="text" name="motor_search[start_date]" id="motor_search_start_date" placeholder="Insurance Start Date">
   </div>
</div>

删除了工具提示标题但它仅在该工具提示显示后首次打开时才有效。我使用了以下代码,但它没有用。

Jquery代码是,

$(".picker__weekday").attr('title','');
$(document).ready(function(){
   var today = new Date();
   var nyr = new Date();
   var prevDate = nyr.setYear(nyr.getFullYear()-90);
   var m = parseInt(prevDate);
   var finDate = new Date();
   finDate.setTime(m);
   var dobPicker = $('#motor_search_year_make').pickadate({
      today: false,
      clear: false,
      close: false,
      selectMonths: true,
      selectYears: 90,
      min:finDate,
      max:new Date(),
      labelMonthNext: '',
      labelMonthPrev: '',
      labelMonthSelect: '',
      labelYearSelect: '',
      hiddenSuffix: '',
      clear: true,
      format: 'dd mmmm yyyy',
      formatSubmit: 'yyyy-mm-dd',
      weekdaysShort: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
      disable: [
         { from: [0,0,0], to: finDate }
      ],
      onClose: function(){
         this.$node.prev('label').removeClass('active');
      },
      onOpen: function(){
         $(".picker__weekday").attr('title','');
      }
    });
 });

1 个答案:

答案 0 :(得分:0)

你可以使用css:

.picker__weekday{
  pointer-events: none;
}

或者只需使用此选项将全名设为空

weekdaysFull: [ '', '', '', '', '', '', '' ]