Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

91
Views
JQuery Validator two digs

I want validate two input types on my site. The second field must be less than the first. Otherwise, an addClass is to be activated for a message. addClass.Message .show_the_massage The IDs and names are fix and can't change.

html:

<div class="wapf-section">
<form id="sample">
    <input type="text" name="wapf[field_6169527c6979a]" id="6169527c6979a" value="">
    <input type="text" name="wapf[field_616ebcec0c389]" id="616ebcec0c389" value="">
    <br/>
</form>
<div>

JQuery:

jQuery(document).ready(function ($) {

    $.validator.addMethod('lessthenother', function (value, element, param) {
        return this.optional(element) || parseInt(value) <= parseInt($(param).val());
    }, 'Invalid value');


    $('.wapf-section').validate({
        errorElement: "small",
        rules: {
            bid_auto_decrement: {
                lessthenother: '6169527c6979a'
            }
        },
        messages: {
            wapf[field_616ebcec0c389]: {
                lessthenother: 'Must be less than bid price.'
            }
        }
    });
    
    $('[name="wapf[field_6169527c6979a]"]').on('change blur keyup', function() {
        $('[name="wapf[field_616ebcec0c389]"]').valid();
    });
    
});
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!