Click here to Skip to main content
14,427,367 members
Rate this:
Please Sign up or sign in to vote.
I have
<input type="time" id="id_start_1"/>
<input type="time" id="id_end_1"/>

How can I add input id = "end" so that its possible value to enter is at least as entered in input id = "start"??

What I have tried:

<pre lang="Javascript">jQuery.validator.addMethod("greaterThan",
        function (value, element, params) {

            if (!/Invalid|NaN/.test(new Date(value))) {
                return new Date(value) > new Date($(params).val());

            return isNaN(value) && isNaN($(params).val())
                || (Number(value) > Number($(params).val()));
        }, 'Musi być większa niż {0}.');

    $("#id_end_1").rules('add', { greaterThan: "#id_start_1" });


Uncaught TypeError: Cannot read property 'addMethod' of undefined

Updated 15-Jan-20 20:39pm

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100