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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T14:29:33+00:00 2026-06-08T14:29:33+00:00

I have textbox with datepicker. according to my requirement user must select either first

  • 0

I have textbox with datepicker. according to my requirement user must select either first tuesday or second tuesday of the month. So i disabled the rest of the dates using following code and its working fine.

var dates_allowed = {
      '2012-07-24': 1,
      '2012-08-14': 1,
      '2012-08-21': 1,
      '2012-09-11': 1,
  '2012-09-18': 1,
      '2012-10-09': 1,
      '2012-10-16': 1
};
$("#" + webinarDate.id).datepicker({
    // called for every date before it is displayed
    beforeShowDay: function(date) {

        // prepend values lower than 10 with 0
        function addZero(no) {
            if (no < 10){
              return "0" + no;
            }  else {
              return no; 
            }
        }

        var date_str = [
            addZero(date.getFullYear()),
            addZero(date.getMonth() + 1),
            addZero(date.getDate())      
        ].join('-');

        if (dates_allowed[date_str]) {
            return [true, 'good_date', 'This date is selectable'];
        } else {
            return [false, 'bad_date', 'This date is NOT selectable'];
        }
    }
});

But problem is user can enter date in textbox instead of using datepicker(Which i dont want that). How to restrict the user to select date from datepicker instead entering manually. i hope you understand..

  • 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-08T14:29:34+00:00Added an answer on June 8, 2026 at 2:29 pm

    You mean this?

    You can set the datepicker input text as readonly using the following.

    In your case will be to this element: $("#" + webinarDate.id)


    <input type='text' id='datepickerTxt' readonly='true'>
    

    Or:

    $("#datepickerTxt").attr('readonly', 'true');
    

    Or:

    $("#datepickerTxt").keypress(function(e){ e.preventDefault(); });
    

    In modern jQuery versions:

    $("#datepickerTxt").prop('readonly', 'true');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a textbox which is filled with date from a datepicker(calendar is accessed
Desktop window application. I have textbox in which user give values in numbers. what
I have a textbox user control and when I double click, it adds the
I have a textbox and a datepicker next to it and I am using
i have one jquery ui datepicker working fine. I am now adding a second
I have an asp:TextBox associated to a jquery DatePicker. This input has a onTextChangedEvent
We have a textbox that we want to both trigger a jQuery UI datepicker,
Hi I have a textbox and a datepicker control. The validator requires that neither
I have a custom user control DatePicker.cs. Inside of another piece of code I
I have a textbox which has JQuery UI DatePicker control registered to it. It

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.