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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T01:44:52+00:00 2026-06-06T01:44:52+00:00

i am using a jquery validation in form my code is following Jquery $(document).ready(function

  • 0

i am using a jquery validation in form my code is following

Jquery

$(document).ready(function () {
    $('#myformid').validate();
    $.validator.addMethod("endDate", function (value, element) {
        var startDate = $('.startDate').val();
        return Date.parse(startDate) <= Date.parse(value);
    }, "* End date must be Equal/After start date");



});

i am trying to compare two dates with jquery , if the end date is greater then start date then jquery shows validation error ,but after showing error if i input some valid date the validation message doesn’t disappear until i submit my form . What should be be the problem ?

  • 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-06T01:44:53+00:00Added an answer on June 6, 2026 at 1:44 am

    If you change only the endDate, the validation should work correctly (see here, submit the form, then fix the endDate, and the error message will disappear), but I’m guessing your problem is when you change the startDate to correct the problem with the endDate…

    In that case, you need to trigger the endDate validation when startDate changes also:

    $('input[name="startDate"]').blur(function(){
        if ($('input[name="endDate"].error').length){
            validateObject.element($('input[name="endDate"]'));
        }        
    });
    

    The if statement just checks whether the endDate input is already in the “error” state and then re-validates it if it is. validateObject is the validate object, which is returned from $('#myformid').validate().

    You can see that version in action here: http://jsfiddle.net/ryleyb/zhN6q/1/

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

Sidebar

Related Questions

I am using jQuery validation plugin (http://bassistance.de/jquery-plugins/jquery-plugin-validation/) Following code is a part of form
the following code: script code <script type=text/javascript> $(document).ready(function() { $(#formElem).validate({ rules: { dimage:{ minlength:200
I'm using JQuery Validation to validate a particular textbox in my form. The textbox
Using jQuery validation - validating on blur: $('input, select, radio, checkbox').blur(function(){ $(#createAccount).validate().element(this); }); If
I am using jquery validation plugin to validate a registration form. Each text input
I am using a jquery.validation plugin to validate my inputs on the form I
I'm using jquery.validate plugin and facing the following situation: <form id=myForm ....> <input type=text
I'm using jQuery.validity to validate PHP form inputs. I need to skip validation when
I'm using jQuery validation to validate a form with a radio button set on
I have a problem trying to validate a user value using the jQuery Validation

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.