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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:48:50+00:00 2026-06-18T12:48:50+00:00

I have a form that allows the user to pick 3 date periods (or

  • 0

I have a form that allows the user to pick 3 date periods (or 1 or 2).
This pattern is repeated allowing the user to select dates for Custom ranges, weekly, monthly, daily and so on.
if there a way I can optimise the jquery so that I dont have to write out the whole jquery function per input?
the only thing that really changes is the number in the id.

<input type='text' id='custom1from'><input type='text' id='custom1until'>
<input type='text' id='custom2from'><input type='text' id='custom2until'>
<input type='text' id='custom3from'><input type='text' id='custom3until'>

<input type='text' id='monthly1from'><input type='text' id='monthly1until'>
<input type='text' id='monthly2from'><input type='text' id='monthly2until'>
<input type='text' id='monthly3from'><input type='text' id='monthly3until'>



$("#custom1from").click(function() {
        $("#custom1from").datepicker();
      });

      $("#custom1until").click(function() {
        $("#custom1until").datepicker();
      });

      $("#custom2from").click(function() {
        $("#custom2from").datepicker();
      });

      $("#custom2until").click(function() {
        $("#custom2until").datepicker();
      });


  $("#custom3until").click(function() {
    $("#custom3until").datepicker();
  });
  $("#custom3until").click(function() {
    $("#custom3until").datepicker();
  });
  • 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-18T12:48:51+00:00Added an answer on June 18, 2026 at 12:48 pm

    Just give it a class and select on that.

    <input type='text' class="datepick" id='custom1from'><input type='text' id='custom1until'>
    <input type='text' class="datepick" id='custom2from'><input type='text' id='custom2until'>
    <input type='text' class="datepick" id='custom3from'><input type='text' id='custom3until'>
    
    <input type='text' class="datepick" id='monthly1from'><input type='text' id='monthly1until'>
    <input type='text' class="datepick" id='monthly2from'><input type='text' id='monthly2until'>
    <input type='text' class="datepick" id='monthly3from'><input type='text' id='monthly3until'>
    
    $(".datepick").datepicker();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form that allows a user to import a spreadsheet. This spreadsheet
I have a form that allows a user to select what report they want
I have a django form that allows a user to select multiple options: CARDS
I'm using Access 2003 and have a form that allows the user to pick
Basically, I have this form that allows user to upload to my server: <form
I have a form that allows a user to select a county from a
I have a form that allows me to enter a user into my database.
I have a TextBox in a Windows Form that allows a user to enter
I have a bound form in microsoft access that allows a user to add
I have a form that allows users to enter a date of birth: ie:

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.