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

  • SEARCH
  • Home
  • 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 7981825
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T10:29:29+00:00 2026-06-04T10:29:29+00:00

By default, the jQuery UI datepicker resets the calendar HTML whenever a date is

  • 0

By default, the jQuery UI datepicker resets the calendar HTML whenever a date is picked. I want to be able to change/add elements of the calendar (add images, backgrounds, etc) and have them stay after a date is clicked.

For example, this script starts as an inline date picker with the background of the 24th blue. When you click another date (say the 15th), the HTML resets and the blue background disappears. I want it to STAY blue after a date is clicked.

<script>

$(function(){
    $('#cal').datepicker({
        onSelect: function(dateText, inst) {
            console.log(dateText);
            // dont do anything else
        }
    });
    $('.ui-state-default:contains(24)').css('background-color','blue');
});

</script>   

<div id='cal'></div>

Demo: http://jsfiddle.net/DtvZM/

See how when you click a day, the 24th turns from blue to white.. I want it to STAY blue.

Note: This is just an example to demonstrate the problem, and not my actual code.

I’m looking to see if there is an easy solution to this before modifying the jQuery UI widget code.

  • 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-06-04T10:29:32+00:00Added an answer on June 4, 2026 at 10:29 am

    I’ve resolved that this isn’t possible without modifying the UI datepicker code, which is what I ended up doing –

    In the _selectDate method, I changed the line:

    if (inst.inline)
        this._updateDatepicker(inst);
    

    to

    if (inst.inline) {
        inst.stay = true;
        this._updateDatepicker(inst);
        inst.stay = false;
    }
    

    Then in _updateDatepicker method, I changed

    inst.dpDiv.empty().append(this._generateHTML(inst));
    

    to

    if (!inst.stay) {
        inst.dpDiv.empty().append(this._generateHTML(inst));
    }
    

    Now UI will not reset the calendar HTML when a date is selected.

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

Sidebar

Related Questions

I have a jquery datepicker which is renders the current date by default as
I'm using inline calendar of this jQuery inline datePicker plugin. By default the days
Possible Duplicate: JQuery Datepicker - no default date When no default date is given
I have an input text containing a default date and I'm using jQuery's Datepicker
How to convert jquery UI datepicker date format for mysql-phpmyadmin datetime type field (default)
I want to replace the default Grails datePicker with the jQuery UI one. Is
How can I achieve this behaviors onclick with jquery : default state: <a href=something.html>Anchor</a>
I want to have site wide default settings for all jQuery validation uses on
Is there a simple way to change the default error values in the jQuery
I have a jquery UI datepicker calendar in an event page(sharepoint page). $('#datepicker').datepicker(); I

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.