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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T14:15:35+00:00 2026-06-01T14:15:35+00:00

I am using jquery datepicker for my application. I want to highlight the dates

  • 0

I am using jquery datepicker for my application.

I want to highlight the dates selected by the user.
User will select a date and that date is added to the database as holiday and the the date should become highlighted. I am already having some dates in database which will be highlighted before using beforeShowDay event and also i have disabled the weekends.

everything is working fine except that i am unable to highlight that date after adding it to database. it is getting highlighted only when i am reloading the calendar.

I searched on internet but didn’t got any clear idea, so many places it is suggested to use multidatepicker but the point is at a time I am selecting only one date adding it to database then selecting other.

please suggest me where i am going wrong.
My code is–

var dates = [ <? php echo $holidays; ?> ];

$(document).ready(function () {
    $("#calendardisplay").datepicker({
        dateFormat: 'yy-mm-dd',
        beforeShowDay: highlightDays,
        onSelect: dateSelected
    });

    function dateSelected(dateText, inst) {
        $.post('/postChannelHoliday.php', {
            'date': dateText
        }, function (data) {
            alert('Successfully Added');
        });
    }
}

function holiday(date) {
    for (var i = 0; i < dates.length; i++) {
        if (new Date(dates[i]).toString().substr(0, 16) == date.toString().substr(0, 16)) {
            return [true, 'ui-state-highlight'];
        }
    }
    return [true, ''];
}

function highlightDays(date) {
    var noWeekend = $.datepicker.noWeekends(date);
    if (noWeekend[0]) {
        return holiday(date);
    } else {
        return noWeekend;
    }
}
});

i am including a php file to get the dates stored in the database to highlight them in calendar

  • 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-01T14:15:36+00:00Added an answer on June 1, 2026 at 2:15 pm

    Instead of alert you need to update list of your holidays (look like dates global object) and than force update of the datepicker by calling refresh on it.

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

Sidebar

Related Questions

I'm using jQuery's datepicker plugin in .NET ASP MVC3 intranet application. User that use
in my application using jquery date picker,my problem is in ui customer select the
My application takes two dates from a user via jQuery Datepicker with a specified
To handle dates, i'm using a jQuery UI public method in my application: jQuery.datepicker.formatDate
I'm using a jQuery datepicker to select an applicant's date of birth, but the
I'm using the JQuery DatePicker to have the user pick a date and have
I am using the following in my application DatePicker from jQuery UI Pretty Photo.
I'm using the jQuery datepicker where I have two textboxes (start date / end
I am using Jquery Date pickers to get Start and End Dates for an
I am using the jQuery Datepicker without any problem for TextBox controls that are

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.