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

102
Views
Validate input field depends on other html elmement jQuery validate function

I m trying to validate to validate the input depends on other html element. If the other html is empty it should validate the input and if not the not valid.

This is my HTML:

<input id="oka_rijkregister_last" name="oka_rijksregisternummer_last" type="text">
<span id="oka_rijkregister_last_BtnVal" class="error_msg"></span>

I have a separate function on input which validate the input data, if data is not correct it displays the error message in span element else remains empty.

Here is my JS code which i am trying to validate depends on span element.

$("#myform").validate({
  rules: {
    oka_rijksregisternummer_last : {
    minlength: {
      param:17,
      depends: function (element) {
          if($("#oka_rijkregister_last_BtnVal").html() === "") {
            return true;
          }
          else {
            return false;
          }
      }
    }
   }
  }
});

My code is working till param 17 and rest it ignores. Can anyone help with this?

Thanks in advance.

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!