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

193
Views
accessing DOM inside node using express GET method with jsdom

i want to access that button inside express get method but it says btn is not defined while i can use it inside JSDOM.fromFile

const jsdom = require("jsdom");
const { JSDOM } = jsdom;
JSDOM.fromFile("./index.html").then(dom => {
  let btn = dom.window.document.querySelector('.btn');
}).catch(err => console.log(err));

app.listen(3000);

app.get("/", (req, res) => {
    res.sendFile("./index.html", {root: __dirname})
    console.log(btn)
  });
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!