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

372
Views
¿Por qué mi código html (Javascript) no funciona en vsCode?

este es un código simple que ayuda a HTML a ejecutar un código que abrirá un cuadro-modal. Pero por alguna razón, no parece hacer nada mientras lo escribo en Vscode pero funciona perfectamente bien mientras lo escribo en 'code-pen'. por favor, dime ¿Por qué mi javascript no funciona así?

 //javascript const open = document.getElementById('click'); const Skill = document.getElementsByClassName('Skill'); open.addEventListener('click' , function() { Skill.classList.add('show'); });
 //html <nav class="nav-bar"> <div class="Logocontainer"> <h1 class="logo"><a href="#">T&S</a></h1> </div> <ul class="Menu"> <li><a href="#home">Home</a></li> <li><a href="#">Team</a></li> <li id="click"><a href="#" id="click">My Skills</a></li> <li><a href="#about me">About Me</a></li> </ul> </nav> });
 //css .Skill{ display: flex; margin-left: 500px; background-color: black; width: 800px; height: 200px; border-radius:10px; color: white; font-weight: bold; align-items: center; justify-content: center; display: none; } .Skill.show{ display:block; }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

getElementsByClassName recupera una lista, como puede ver por el nombre: "elementos". Plural.

cambio

 const Skill = document.getElementsByClassName('Skill')

a

 const Skill = document.getElementsByClassName('Skill')[0];

para acceder al primer elemento con clase "habilidad".

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!