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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:10:32+00:00 2026-06-13T20:10:32+00:00

I am using a date picker js. I want to set a validation when

  • 0

I am using a date picker js.
I want to set a validation when the end date changed, the validation sets in..


HTML :

> <table width="52%" height="216" border="0"align="center">   <tr
> class="font_style">
>     <td height="30" valign="top">Academic Start Date</td>
>     <td width="51%" valign="top"><input name="txt_ACStart" type="text" id="txt_ACStart" readonly="readonly" /></td>   </tr>   <tr
> class="font_style">
>     <td height="30" valign="top">Academic End Date</td>
>     <td valign="top"><p>
>       <input name="txt_ACEnd" type="text" id="txt_ACEnd" readonly="readonly" />
>     </p>
>     <div id="validate_AC" style="display:none">End date must be higher than Start date</div></td>   </tr>   <tr class="font_style">
>     <td height="30" valign="top">Attendance Start Date</td>
>     <td valign="top"><span class="style_table_elm">
>       <input name="txt_ATStart" type="text" id="txt_ATStart" readonly="readonly" />
>     </span></td>   </tr>   <tr class="font_style">
>     <td height="30" valign="top">Attendance End Date</td>
>     <td valign="top"><p class="style_table_elm">
>       <input name="txt_ATEnd" type="text" id="txt_ATEnd" readonly="readonly" />
>     </p>
>     <div id="validate_AS" style="display:none">End date must be higher than Start date</div></td>   </tr>   <tr class="font_style">
>     <td height="30"><span class="style_table_elm">
>       <input type="checkbox" name="chk_weekendvar" id="chk_weekendvar" />
>       <strong>Attendance on Mon - Sat</strong>
>     </span></td>
>     <td>&nbsp;</td>   </tr>   <tr class="font_style">
>     <td height="30" colspan="2"><blockquote>
>       <blockquote>
>         <blockquote>
>           <blockquote>
>             <p>
>               <input type="submit" name="btn_save" id="btn_save" value="Save" action="toggle()" />
>             </p>
>           </blockquote>
>         </blockquote>
>       </blockquote>
>     </blockquote></td>   </tr> </table>

JavaScript :

<script type="text/javascript">
    var valid1 = document.getElementById("validate_AC");
    var valid2 = document.getElementById("validate_AT");
    var ACdate1 ="";
    var ACdate2 ="";
    var ATdate3 ="";
    var ATdate4 = "";

    $(document).ready(function(){
        $("txt_ACEnd").bind("change",toggle1);
        $("txt_ATEnd").bind("change",toggle2);
    });

    function toggle1(){
        ACdate1 = document.getElementById("txt_ACStart").value();
        ACdate2 = document.getElementById("txt_ACEnd").value();


        if(ACdate1 > ACdate2)
        {
            valid1.style.display = "block";
        }
        else
        {
            valid1.style.display = "none";
        }

    }

    function toggle2()  {
        ATdate3 = document.getElementById("txt_ATStart").value();
        ATdate4 = document.getElementById("txt_ATEnd").value();

        if(ATdate3 > ATdate4)
          {
              valid2.style.display = "block";
          }
          else
          {
              valid2.style.display = "none";
          }

    }

How to make when the txt_ACEnd is changed, it will run the toggle1 function
and when the txt_ATEnd is changed, it will run the toggle2 function?

and is my toggle1 and toggle2 function correct or will it not run?

  • 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-13T20:10:33+00:00Added an answer on June 13, 2026 at 8:10 pm

    check this:

    $(document).ready(function(){
        $("txt_ACEnd").bind("change",toggle1);
        $("txt_ATEnd").bind("change",toggle2);
        //^------------You have to use jQuery way to select the selectors-------
    });
    

    and it should be like this:

    $(document).ready(function(){
        $("#txt_ACEnd").bind("change",toggle1);
        $("#txt_ATEnd").bind("change",toggle2);
    });
    
    use '#' for id capture
    use '.' for class capture
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using jquery date picker in textbox and i want the user cannot
I'm using this datetime picker and want to set the minDate to today at
I have a date picker which is shown using an action sheet. I want
I am using Terelik Date Picker in my project and when i click on
I'm trying to write my first iPhone app, and I'm using a date picker
I am using the Date Range Picker (http://www.filamentgroup.com/lab/date_range_picker_using_jquery_ui_16_and_jquery_ui_css_framework/) plugin and need to get the
I am using the jQuery Date picker, but it is too heavy, the minified
I'm using the jQuery date picker widget and it works nicely but I'm confused
I am using Jonathan Leighton's Date Picker Plugin (Input Date) URl : http://jonathanleighton.com/projects/date-input The
I'm using ExtJS 3 and when I want to select a date for the

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.