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

209
Views
VS Code Live Server extension adding/duplicating existing HTML element

I'm using the Liver Server extension in VS Code to see the result of some HTML/JS I'm experimenting with, however, it appears Live Server is injecting it's own duplication of one of the HTML elements (in this case an empty div) and joining it onto the bottom of the document. I'm fairly certain Live-Server is the issue here because I've had a look at my code on Codepen and the issue does not appear.

I hope providing a link to Codepen is ok: https://codepen.io/UnmadeBed/pen/PoEoMKy

main.js:

// grab elements from HTML doc
const body = document.querySelector('body');

// container to hold the grid divs
const containerDiv = document.createElement('div');
containerDiv.style.backgroundColor = 'red';
containerDiv.style.height = '500px';
containerDiv.style.width = '500px';
body.appendChild(containerDiv);

const div = document.createElement('div');
containerDiv.appendChild(div);

Chrome dev tools elements tab Additional blue div added by Live Server

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

0

Solved. It turns out I was accidentally styling a hidden div used by Live Server, as opposed to Live Server duplicating anything.

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!