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

150
Views
javascript no muestra un nuevo elemento en la pantalla

MI archivo html:

 <div class="container"> ... <button type="button" onclick="displayResult()">Display results</button> </div>

Y quiero que después de hacer clic en el botón, se muestre una lista:

 function displayResult() { const list1 = document.createElement("ul"); const res = document.getElementsByClassName("container"); res.appendChild(list1); const unordered_list3 = document.createElement("li"); const text3 = document.createTextNode("3"); unordered_list3.appendChild(text3); list1.appendChild(unordered_list3); const unordered_list1 = document.createElement("li"); const text1 = document.createTextNode("1"); unordered_list1.appendChild(text1); list1.appendChild(unordered_list1); const unordered_list2 = document.createElement("li"); const text2 = document.createTextNode("2"); unordered_list2.appendChild(text2); list1.appendChild(unordered_list2); }

Pero cuando hice clic en el botón, no aparece nada en la pantalla. ¿Hay algo mal?

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!