Try to search your question here, if you can't find : Ask Any Question Now ?

I'm using jsdom but still cannot access document

HomeCategory: stackoverflowI'm using jsdom but still cannot access document
pushpa asked 2 weeks ago

I’m trying to access an element by id to remove a class but getting error saying TypeError: dom.getElementById is not a function

const jsdom = require("jsdom").JSDOM;

dom = new jsdom("index.html");
jsdom.defaultDocumentFeatures = {
    QuerySelector: true
  };


app.post("/login", function(req, res) {

    var email = req.body.emailInput;
    var password = req.body.passwordInput;

    if(email == acct1.email && password == acct1.password) {
        dom.getElementById("userName").classList.remove("hidden");
        res.redirect("/");
    } 
});

1 Answers
Best Answer
Matthias answered 2 weeks ago
Your Answer

11 + 20 =

Popular Tags

WP Facebook Auto Publish Powered By : XYZScripts.com