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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:20:49+00:00 2026-06-05T07:20:49+00:00

I am trying to create date functionality using jquery on start date and end

  • 0

I am trying to create date functionality using jquery on start date and end date controls. i want to select start date and when coming to end date before the start date , the previous date will come as disable my code is below.

$( "#" + TxtStrtDate,"#" + TxtExpDte" ).datepicker({
    defaultDate: "+1w",
    changeMonth: true,
    numberOfMonths: 3,
    onSelect: function( selectedDate ) {
        var option = this.id == "abc" ? "minDate" : "maxDate",

        instance = $( this ).data( "datepicker" ),
        date = $.datepicker.parseDate(
            instance.settings.dateFormat ||
        $.datepicker._defaults.dateFormat,
        selectedDate, instance.settings );

        dates.not( this ).datepicker( "option", option, date );
    }
});

what is the mistake in my code please suggest.

  • 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-05T07:20:50+00:00Added an answer on June 5, 2026 at 7:20 am

    Since you mentioned that these were server controls, I assume you are using ASP.NET. If this is the case and you are using MasterPages, MasterPages mangle the id of the control so you have to do the following:

    $('#<%= TxtStrtDate.ClientID %>, #<%= TxtExpDte.ClientID %>').datepicker({
    ...
    });
    

    Otherwise, you have an extra ” in your selector and your ids need to be within the quotes unless they are actually javascript variables:

    $( "#" + TxtStrtDate,"#" + TxtExpDte" )
    

    should be changed to:

    $("#TxtStrtDate, #TxtExpDte")
    // or if they are javascript variables
    $("#" + TxtStrtDate + ", #" + TxtExpDte)
    

    Edit:

    Per your comment, it seems that you want to use the date range version of the jquery datepicker. For that you will have to do the following:

    $( "#TxtStrtDate" ).datepicker({
        defaultDate: "+1w",
        changeMonth: true,
        numberOfMonths: 3,
        onSelect: function( selectedDate ) {
            $( "#TxtExpDte" ).datepicker( "option", "minDate", selectedDate );
        }
    });
    $( "#TxtExpDte" ).datepicker({
        defaultDate: "+1w",
        changeMonth: true,
        numberOfMonths: 3,
        onSelect: function( selectedDate ) {
            $( "#TxtStrtDate" ).datepicker( "option", "maxDate", selectedDate );
        }
    });
    

    Checkout the date range demo on the jquery ui site for more information.

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

Sidebar

Related Questions

I am trying to create a select list starting from the current date of
I am trying to create a website using some of the Razor functionality, but
I am trying to get a date range using Guava's new Range functionality, via
i'm trying to create a database with 4 columns(name,contact,date,mail) and i want to insert
I am trying to create a date object that is 90 days from a
I am trying to create a new date object from string as follows: var
I am trying to create an HTML5 input date component so that I can
I'm trying to create a simple function which returns me a date with a
I'm trying to create a very simple message board (author, text, and date written)
Does anybody know which date format is to be used, trying to create a

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.