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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:35:52+00:00 2026-05-27T18:35:52+00:00

I am having two text fields From, To.Here i want to do many things

  • 0

I am having two text fields From, To.Here i want to do many things with is two fields.

  1. I want to select next three days on selected date.Which means,if I am selecting jan 1,2012 in From field , then To field should automatically select jan 1,2,3 2012.
  2. While I am hover on jan 1, It should highlight jan 1,2,3
  3. While I am selecting on jan 1 it should it disable after 10 days (after jan 10 all dates should disabled)
  4. Suppose I disabled jan 2 means.While I am selecting jan 1 tool tip message should say you can’t select these dates.

Give me the reference idea which functions are used to do this.If you have example code for any of these please share.It will be very help full.

This is my setup

var dates = jQuery("#From,#To").datepicker({
    beforeShowDay: excludeDates,
    showButtonPanel: true,
    dateFormat: "m/d/y",
    altFormat: 'yy-mm-dd',
    minDate: 0,
    onSelect: function(selectedDate, inst) {
        var option = this.id == "From" ? "minDate" : "maxDate",
            instance = jQuery(this).data("datepicker"),
            date = jQuery.datepicker.parseDate(instance.settings.dateFormat || jQuery.datepicker._defaults.dateFormat, selectedDate, instance.settings);
        dates.not(this).datepicker("option", option, date);

        var d = new Date(inst.selectedYear, inst.selectedMonth, inst.selectedDay);
        var mydate = jQuery.datepicker.formatDate('yy-mm-dd', d);





    }
});

Thanks in advance

  • 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-27T18:35:53+00:00Added an answer on May 27, 2026 at 6:35 pm

    It’s not a complete answer but I’ve hacked something together which should hopefully get you started. It meets some of your requirements but the hover highlighting is not perfect (sometimes extra dates are left highlighted) and I’m not happy with all of the JavaScript Date objects so there is probably some optimisation to be done. The code is included below:

    HTML

    From:<div id="fromDate"></div>
    To:<div id="toDate"></div>
    

    CSS

    body {
        margin:10px 0 0 5px;
        font-family:Verdana;
        font-size:.8em;
    }
    
    .ui-datepicker .ui-datepicker-calendar .ui-state-highlight a {
        background: #743620 none; /* a color that fits the widget theme */
        color: white; /* a color that is readeable with the color above */
    }
    

    JavaScript

    $('#fromDate').datepicker({
        onSelect: function(dateText, inst) {
            // set range <selected, +10d> on toDate
            var minDate = $(this).datepicker('getDate');
            var maxDate = new Date(minDate);
            maxDate.setDate(maxDate.getDate() + 9);
    
            var plusOne = new Date(minDate);
            plusOne.setDate(minDate.getDate() + 1);
            var plusTwo = new Date(minDate);
            plusTwo.setDate(minDate.getDate() + 2);
            var nowPlusThree = [minDate, plusOne, plusTwo];
    
            $('#toDate').datepicker('destroy').multiDatesPicker({minDate: minDate, maxDate:maxDate, 'addDates': nowPlusThree});
    
            $('#fromDate').off('hover', 'a');
        }
    });
    
    $('#toDate').datepicker();
    
    $('#fromDate').on('hover', 'a', function() {
        var hoveredDate = new Date($('#fromDate .ui-datepicker-month').text() + ' ' + $(this).text() + ' ' + $('#fromDate .ui-datepicker-year').text());
    
        var plusOne = new Date(hoveredDate);
        plusOne.setDate(hoveredDate.getDate() + 1);
        var plusTwo = new Date(hoveredDate);
        plusTwo.setDate(hoveredDate.getDate() + 2);
        var nowPlusThree = [hoveredDate, plusOne, plusTwo];
    
        var existingDates = $('#toDate').multiDatesPicker('getDates');
        $('#toDate').multiDatesPicker('removeDates', existingDates);
        $('#toDate').multiDatesPicker({'addDates': nowPlusThree});
    });
    

    Note that the demo jsFiddle also includes a jQueryUI Theme and the Multiple Dates Picker plugin as advised by @diEcho

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

Sidebar

Related Questions

I am having two text fields in my form. The data to be entered
Hey Friends i am having one forms and two button, and some text fields,what
There is a list of names and investment in two separate text fields, name
I have a jsp page having two text field id and name. Now I
i am having trouble trying to call values from two IASKCustomViewSpecifier in the InAppSettingsKit.
I am having trouble understanding why this is not working. I have two fields
Having two forms, each in it's own jQuery UI tab, how can I post
We are having two load balancing server. In that we have hosted a asp.net
I am having two activities A and B. when i click the button in
I have seen new computers having two processors on same motherboard . How can

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.