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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:49:25+00:00 2026-06-15T18:49:25+00:00

I have implemented a jquery fullcalendar in a ROR application. In the month view

  • 0

I have implemented a jquery fullcalendar in a ROR application. In the month view of fullcalendar, I need to change the background color of the dates from start date to end date. I got the start date and end date. But I am not able to change the background color of these dates. I have tried like below but it is changing for all the months(from start date to end date) of the calendar. Is there any other way to achieve this?? Please help. I am a novice in Javascript.

$(document).ready(function () {

var calInstance = $('#calendar')
$('.task_name').live('click', function () {
    alert(this.id);
    $.ajax({
        url: 'pending_task_details',
        dataType: 'json',
        cache: false,
        data: {
            task_id: this.id
        },
        success: function (data, response, event, date) {
            var start_date = new Date(data.start_date);
            var end_date = new Date(data.end_date);
            alert("The start date is....." + start_date);
            alert("The end date is..........." + end_date);
            for (i = start_date; i <= end_date; i = new Date(i.getTime() + 86400000)) {
                getCellFromDate(i, calInstance);
            }
        }
    });
});


function getCellFromDate(thisDate, calInstance) {
    var d = thisDate.getDate();
    var m = thisDate.getMonth();
    var y = thisDate.getFullYear();
    $('#calendar').fullCalendar('gotoDate', y, m, d);
    var coords = calInstance.fullCalendar('getView').dateCell(new Date(thisDate)),
        $row = calInstance.find('.fc-view-month tbody tr').eq(coords.row),
        $cell = $row.find('td').eq(coords.col);
    $($cell).find('.fc-day-number').parent().css('background-color', '#6E5849');
    $($cell).find('.fc-day-number').css({
        'background-color': '#6E5849',
        'border': '1px solid #6E5849'
    })
}
});
  • 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-15T18:49:26+00:00Added an answer on June 15, 2026 at 6:49 pm

    First you need a function get a handle on the day of the month element

    Something like this:

         // based on the given event date return the full calendar day jquery object (<td ...>)
         // matching day and month
         //
         // assumptions:
         //  - the event date is if for the same year as the current viewable month
         //  - the fc-day* TD's are in chronological order
         //  - the fc-day* TD's not for the current month have a class of fc-other-month
         //
        findFullCalendarDayForClickedEvent : function( eventDate ) {
    
            var foundDay;
    
            var $theCalendar = $( '#myCalendar' );
    
            var currentDate = $theCalendar.fullCalendar( 'getDate' );
            var fullCalendarDayContainers = $theCalendar.find( 'td[class*="fc-day"]' );
    
            for( var i = 0; i < fullCalendarDayContainers.length; i++ ) {
    
                var $currentContainer = $( fullCalendarDayContainers[ i ] );
    
                var dayNumber = $currentContainer.find( '.fc-day-number' ).html();
    
                // first find the matching day
                if ( eventDate.getDate() == dayNumber ) {
    
                    // now month check, if our current container has fc-other-month
                    // then the event month and the current month needs to mismatch,
                    // otherwise container is missing fc-other-month then the event
                    // month and current month need to match
                    if( $currentContainer.hasClass( 'fc-other-month' ) ) {
    
                        if( eventDate.getMonth() != currentDate.getMonth() ) {
                            foundDay = $currentContainer;
                            break;
                        }
                    }
                    else {
                        if ( eventDate.getMonth() == currentDate.getMonth() ) {
                            foundDay = $currentContainer;
                            break;
                        }
                    }
                }
            }
    
            return foundDay;
        }
    

    For more see: https://stackoverflow.com/posts/13647014/edit

    Next loop over your time frame passing in each date to the finder function.

    Then

    foundDay.addClass( 'selected-day' );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have implemented JQuery FullCalendar by fetching the events dynamically from an aspx page.
I have implemented an application using jQuery on PhoneGap. In that I'm using a
I have implemented the jquery autocomplete combobox, however the change event does not seem
I have implemented an application using jQuery mobile and phone gap (cordova based application)
I Have implemented Split view model in Jquery mobile + phone gap by following
I have implemented a Phonegap application for iPhone using jQuery mobile . I have
I have implemented a PhoneGap application for andriod and iPhone using jQuery Mobile and
I have implemented a jquery ui autocomplete with data from database. Right now what
I have implemented jquery on the site (click on the plus sign) http://pligg.marsgibson.info Issue
I have implemented the jquery ui autocomplete as in the example: autocomplete with custom

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.