jQuery datepicker删除当前日期突出显示类 [英] jquery datepicker remove current day highlight class

查看:100
本文介绍了jQuery datepicker删除当前日期突出显示类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从我的jquery datepicker实例中完全删除当天的突出显示类.我将datepicker内联用作div,因此我发现在类上使用.find和.remove的所有规定方法均无效.我尝试删除.ui-state-highlight的所有CSS条目,但没有任何改善.我的基本代码进行了代码检查,显示了我需要删除的类.

I want to completely remove the current day highlight class from my instance of jquery datepicker. I am using datepicker inline as a div, so all the prescribed methods I have found for using .find and .remove on classes are not working. I have tried removing all the CSS entries for .ui-state-highlight to no improvement. The of the code inspection, showing the class i need to remove.

代码:

<head><script>
$( function() {
var selections = ["2017-07-29"]
function bansingle(date) {
        var excerpt = jQuery.datepicker.formatDate('yy-mm-dd', date);
        return [ selections.indexOf(excerpt) == -1 ]
    }
// somehow combine this function later.
//function bandow(date) {
//              var day = date.getDay();
//          return [(day != 0 && day != 6)];
//      }


$('#dp1').datepicker({
    beforeShowDay: bansingle,
    altField:'#alternate1',
        altFormat: 'm-d-yy',
        fielddateFormat: 'm-d-yy',
    minDate: "+0d",
    //maxDate: "+1m", // set latest selectable date
});
$('#dp1').datepicker("setDate", null); //clears alternate1 input field value
});</script>
</head>
<body>
<div id="dp1"></div>
</body>

编辑突出显示以使其看起来与其他可用日期一样不好,因为单击当前日期后您就无法确定它已经过去了.这就是为什么我需要弄清楚如何在div使用datepicker时完全删除Highlight类.

editing the highlight to look just like the other available dates is no good as then when the current date is clicked, you cant tell that it has been. That's why i need to instead figure out how to remove the highlight class altogether on my div use of datepicker.

我的问题不同于其他问题,因为:尽管与其他帖子有一些共通之处,但我试图做到这一点.最终结果有所不同,正如我在上一节中所述,该帖子的建议是将CSS样式化以模仿其他单元格,这并不适合我的需求.

my question is different from this other question because: while there are some commonalities with that other post, I am trying to acheive a different end result, and the suggestions on that post are styling the CSS to mimic the other cells, as I stated in the paragraph above this one, that is not a good fit for what i need.

使用该其他问题作为参考,我能够重新排列和更改其他CSS样式,以便现在所有可用的日期看起来一样,尽管最终结果不完整.这使我依赖于保持altfield可见,以向用户显示单击的选择.如果可以在文件头中使用这种样式:

Using that other question as a reference, I was able to rearrange and change some other CSS styling so that now all available dates look identical, though the end result is incomplete. this makes me rely on leaving the altfield visible to show the clicked on selection to the user. If there is a way to have this style in the file head:

.ui-state-active {background: #F00;}

更改为:

.ui-state-active {background: #F00 !important;}

首先在任何可用日期上单击datepicker内联日历GUI,然后颜色响应将与用户的操作以及将传递给PHP的数据相匹配.

when the datepicker inline calendar GUI is first clicked on any available date, then the color response will match the user's action as well as the data that will be passed on to the PHP.

推荐答案

您可以按如下所示覆盖CSS.

You can override css as below.

.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default
{
    border: 1px solid #c5dbec;
    background: #dfeffc url(images/ui-bg_glass_85_dfeffc_1x400.png) 50% 50% repeat-x;
    color: #2e6e9e;
}

这篇关于jQuery datepicker删除当前日期突出显示类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆