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

148
Views
How to create dom elements with javascript?
over 4 years ago · Alberto de Jesus Carcamo Nazar
1 answers
Answer question

1

Using the .createElement() method we can create an HTML in memory ( it won't be embedded in our HTML document yet! ). With said element stored in a variable, we can modify its characteristics or content, to later insert it in a certain position of the DOM or HTML document.

For example:

 const myDiv = document.createElement("div"); myDiv.innerText = "Hello World"; myScript.id = "custom-script"

This will create an element in memory called myScript that has as text the HTML paragraph "Hello World" and to insert it to the DOM or HTML document is as follows:

 document.body.appendChild(myScript);

This will insert it into the body of your application's HTML document.

over 4 years ago · Santiago Trujillo 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!