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

163
Views
Style is not defined in Javascript

enter image description here

enter image description here

how document.getelementbyclassname("but") I'm not able to modify the style inside the function. when i try to run the code i get this error enter image description here

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

When you use getElementsByClassName you are getting an array of elements. To fix your error, make sure to select the element you need, e.g.:

inputstxt[0].style.border = ..

Or if you want to apply the new styles to all:

for(let i = 0; i < inputstxt.length; i++) {
   inputstxt[i].style.border = ..
}
about 4 years ago · Juan Pablo Isaza Report

0

cannot set properties of undefined means that you are trying to read the style of an Array instead of an element. So you would need to document.getElementsByClassName("but")[i].style //i is any index to get/set the style.

about 4 years ago · Juan Pablo Isaza Report
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!