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 6345893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:54:41+00:00 2026-05-24T20:54:41+00:00

DatePicker has an internal function, _adjustDate() , which I’d like to add a callback

  • 0

DatePicker has an internal function, _adjustDate(), which I’d like to add a callback after.

Current Method


This is how I’m currently doing this. Basically, just replacing the function defintion with itself, plus the new operations. This effects all datepickers, which I’m not sure is desired, either.

$(function(){

   var old = $.datepicker._adjustdate;

   $.datepicker._adjustDate = function(){
      old.apply(this, arguments);

      // custom callback here     
      console.log('callback');
   };

});

_adjustDate is what’s called during the next/prev month clicks. The function takes three parameters. I’m curious if there’s a better way to add the callback.

Expected Result


I’d like to have the end result look like this; where afterAjustDate is the callback handle:

$('#datepicker').datepicker({ 
       showButtonPanel: true
     , afterAdjustDate: function(){ $(this).find('foo').addClass('bar'); }
});

FYI


onChangeMonthYear is not an acceptable event alternative, neither are the live()/delegate() (don’t work in IE) binding options.

This comes from the need of applying classes/manipulating elements after the month is selected. Changing the month recreates elements in the calendar; when this is performed jQueryUI is not smart enough to inherit the class changes. Thus, I need a callback after changing the date.

  • 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-24T20:54:42+00:00Added an answer on May 24, 2026 at 8:54 pm

    I wrote a small demo that does this…

    I create an object literal that contains the extensions to $.datepicker and then do $.extend on $.datepicker and my object.

    You can check it out here: http://jsfiddle.net/NHN4g/4/

    Here’s the extension itself:

    (function($){
        var datepickerExtensions = {
            _oldAdjustDate: $.datepicker._adjustDate,
            _adjustDate: function(id, offset, period) { 
                var target = $(id);
                var inst = this._getInst(target[0]);
                var afterAdjustDate = this._get(inst, 'afterAdjustDate');
                this._oldAdjustDate(id, offset, period);
                if(afterAdjustDate && typeof afterAdjustDate === 'function'){
                    afterAdjustDate(id, offset, period);
                }
            }
        }
        $.extend($.datepicker, datepickerExtensions);
    })(jQuery);
    

    And the demo:

    (html)

    <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/base/jquery-ui.css" type="text/css" media="all">
    <div class="demo">
        <p>Date: <input type="text" id="datepicker"></p>
    </div><!-- End demo -->
    

    (javascript)

    var changed = false;
    $("#datepicker").datepicker({ 
        afterAdjustDate: function(i,o,p){
            if(!changed){
                $('.ui-datepicker-month').css('color', '#f00');
            }
            changed = !changed;
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a DatePicker working on a View which also has a ViewModel associated
I am trying to build a datepicker which has today as a minimum date
I am having a problem with the jQuery datepicker. My form has a add
I have an asp:TextBox associated to a jquery DatePicker. This input has a onTextChangedEvent
I'm trying to get my datepicker (jQuery UI Datepicker), which has one field for
I have a textbox which has JQuery UI DatePicker control registered to it. It
How do I know when the date has been changed in a DatePicker widget?
I am currently working on a page that has a date picker for one
The datepicker function only works on the first input box that is created. I'm
I am using jquery datepicker, please see below code $(document).ready(function() { $(.txtDate).datepicker({ showOn: 'button',

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.