Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7655107
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T12:25:44+00:00 2026-05-31T12:25:44+00:00

I am currently attempting to change the css of specific dates inside a jQuery

  • 0

I am currently attempting to change the css of specific dates inside a jQuery UI datepicker. If the date is considered a holiday (i.e., it matches a date in a given array of dates), I would like to remove the default image and add some small tweaks to that given element. I add a “holiday” class to dates considered holidays by using the beforeShowDay callback function like so (weekends are marked with a weekend class):

beforeShowDay: function(oDate) {
        mResult = oHolidays.fnLookupDate(oDate);
        if (mResult != null) // if the date matched a holiday, mResult is the description
            return [false, 'holiday', mResult];
        else if (oDate.getDay() == 0 || oDate.getDay() == 6) // weekends
            return [false, 'weekend'];
        else // normal day
            return [true, ''];
    }

Theoretically, applying a class to the tds of each holiday should allow me to specify whatever styling I want for each holiday in the datepicker. However, none of the styling I use in the class actually appears; the UI styling takes priority.
I could, of course, solve the problem by removing the css styles from the UI css file, but that’s a really bad approach from a design standpoint. Here is the CSS I specify (specifying !important did not change anything):

td.holiday {
    background-color: #CC9900;
    background-image: none;
    color: #990000;
    font-weight: bolder;
}

I tried to ‘hack it’ by applying the css as an inline style to the a nodes within the td nodes generated by datepicker (more specific, more inner rules should have higher CSS priority) and do something like this:

    onChangeMonthYear: function(dateText, inst) {
        $('.holiday').children('a').css({'background-color': 'blue', 'background-image': 'none', 
                                         color: '#990000', 'font-weight': 'bolder'});
    }

It seems that the onChangeMonthYear will run this function before the datepicker is displayed. And since this happens, the css of the datepicker overrides what I was trying to do. If I just run this bit of code in Firebug with a datepicker open, it works perfectly fine.

Is there anyway to use .css() to change the css of the datepicker after the a month is displayed? I want to avoid trying to change the jQuery UI css or js files. Even so, this seems like a bad design. Any other ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T12:25:46+00:00Added an answer on May 31, 2026 at 12:25 pm

    The CSS you listed, espcially with the !important on there, should override the default styles. As long as the styles come after the default ones, they should override with no problems whatsoever. JQuery UI shouldn’t even be putting anything inline on the TDs which would require you to use !important.

    Any chance you have an example up somewhere? This is probably something really simple. As long as you have the classes in the DOM on the correct dates, it should be minor CSS with no funny stuff.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm attempting to change the wrapper width on a wordpress blog. It's currently set
I'm currently attempting to disable a link using the following jQuery selector: $(a[href$=/sites/abcd/sectors]).removeAttr(href); The
currently i'm attempting to using a switch statement to change between time zone with
I'm currently attempting to create a tabbed interface in a web application, and based
I am currently attempting to implement a custom gridview interface to display data from
I'm currently attempting to migrate a legacy VBA/Microsoft Access application to Python and PyQt.
I am currently attempting to use Lucene to search data populated in an index.
I'm currently attempting to code one for part of a college project - binary/hex
How do I force a 32-bit build of Boost with GCC? Currently attempting by
I am currently having problems with attempting to style the HTML rich text editor

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.