从jquery ui datepicker中删除title,tooltip,tooltipenable

时间:2022-09-30 19:43:22

I need to know how can I remove the title,tooltip,tooltipenable attribute from a jquery ui datepicker so that it will also not show as a tooltip when click on next and previous on datepicker. Below is the code

我需要知道如何从jquery ui datepicker中删除title,tooltip,tooltipenable属性,以便在单击datepicker上的next和previous时它也不会显示为工具提示。以下是代码

$("#startDate").datepicker(
        { beforeShowDay: function(date) {
         var day = date.getDay();
         var date1 = date.getDate();
         var today = new Date();
         var difference = date - today;
         var daysDifference = Math.round(difference/(1000*60*60*24));         
          if(daysDifference < 0) {
                 return [false]
         }else{
           return [true]
         }

          }
        });

    $( "#startDate").datepicker( "option", "dateFormat", "yy/mm/dd" );
    $( "#startDate" ).datepicker({ minDate: '+0m +0w +1d'});

I have tried this but no use:

我试过这个但没用:

$(".ui-datepicker-next ui-corner-all").removeAttr("title");
$(".ui-datepicker-prev ui-corner-all").removeAttr("title");

in html

<a class="ui-datepicker-next ui-corner-all" onclick="DP_jQuery_1430805360315.datepicker._adjustDate('#startDate', +1, 'M');" tooltip="Next" tooltipenable="true">
<span class="ui-icon ui-icon-circle-triangle-e">Next</span>
</a>

How can I remove them. Thanks

我该如何删除它们。谢谢

1 个解决方案

#1


2  

If you need to hide only tooltip then you can add empty text in prevText, nextText options, empty title won't show in default tooltip, try this code

如果你只需要隐藏工具提示然后你可以在prevText,nextText选项中添加空文本,空标题将不会显示在默认工具提示中,请尝试此代码

$(function() {
  $("#startDate").datepicker({
    beforeShowDay: function(date) {
      var day = date.getDay();
      var date1 = date.getDate();
      var today = new Date();
      var difference = date - today;
      var daysDifference = Math.round(difference / (1000 * 60 * 60 * 24));
      if (daysDifference < 0) {
        return [false]
      } else {
        return [true]
      }

    }
  });

  $("#startDate").datepicker("option", "dateFormat", "yy/mm/dd");
  $("#startDate").datepicker({
    minDate: '+0m +0w +1d'
  });
  $("#startDate").datepicker("option", "prevText", "");
  $("#startDate").datepicker("option", "nextText", "");
})
<link href="http://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="http://code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<input type="text" id="startDate">

#1


2  

If you need to hide only tooltip then you can add empty text in prevText, nextText options, empty title won't show in default tooltip, try this code

如果你只需要隐藏工具提示然后你可以在prevText,nextText选项中添加空文本,空标题将不会显示在默认工具提示中,请尝试此代码

$(function() {
  $("#startDate").datepicker({
    beforeShowDay: function(date) {
      var day = date.getDay();
      var date1 = date.getDate();
      var today = new Date();
      var difference = date - today;
      var daysDifference = Math.round(difference / (1000 * 60 * 60 * 24));
      if (daysDifference < 0) {
        return [false]
      } else {
        return [true]
      }

    }
  });

  $("#startDate").datepicker("option", "dateFormat", "yy/mm/dd");
  $("#startDate").datepicker({
    minDate: '+0m +0w +1d'
  });
  $("#startDate").datepicker("option", "prevText", "");
  $("#startDate").datepicker("option", "nextText", "");
})
<link href="http://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="http://code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<input type="text" id="startDate">