Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

103
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda