Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

104
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda