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
Avatarpushpa asked 3 months 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
AvatarMatthias answered 3 months ago
Your Answer

3 + 19 =

Popular Tags

WP Facebook Auto Publish Powered By : XYZScripts.com