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

250
Views
How to use VS Code to debug JavaScript within HTML?

How do I set up Visual Studio Code to debug with breakpoints a JavaScript file which is part of an HTML file?

What I want to accomplish is demonstrated in this video, but it doesn't explain how to set it up:

https://www.youtube.com/watch?v=2ub2GCC8DHg&t=190s

Edit:

What the video shows: The video shows a JavaScript program (and the HTML file it's attached to) running in Microsoft Edge browser. The JavaScript is being debugged in VS Code with breakpoints. The browser pauses when a break point is reached. Then the browser resumes when the JavaScript resumes running after the break point.

What I've tried: I've installed VS Code and I'm able to debug standalone (not part of an HTML file) JavaScript with break points. When it comes to running JavaScript that's part of an HTML file, I can run the files in a web browser by pasting into it the file path of the HTML file. I'm also able to run the files with an extension called Live Preview by Microsoft. The JavaScript and HTML files run fine together without errors in my browser.

Where I'm stuck: There is no sync between the browser and VS Code. When I try to debug the JavaScript, it doesn't know it's part of the HTML. It is debugged as standalone, so there's an error because it needs the DOM object from the HTML file.

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!