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

131
Views
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
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!