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

142
Vistas
Cannot get the label's property value in jquery

I have a small JavaScript code which is called on a button click event.

What I want is just to access an html label property when some validation fails.

I have the following code:

if (datePicker1.get_selectedDate() == null && datePicker2.get_selectedDate() == null) {
      //alert("At least one date should be selected");
        alert($('#lblValidate').attr('id'));
      //$('#lblValidate').css("visibility","visible");                
        eventArgs.set_cancel(true);
       }

I commented out some code for a moment. The first alert works, however when trying to display an alert to show a label's id property, alert is not shown.

This is the label:

<label id="lblValidate" style="visibility:visible; color:red;">Enter a valid date</label>

What I eventually want to accomplish is have a label hidden and then when the validation fails, to set the label's css to visible, instead of showing an alert.

But, somehow, I cannot display a label attribute in the alert at all.

What am I doing wrong?

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