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

132
Visualizações
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 à 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