'ReferenceError: document is not defined when using document.getElementById()
code:
const admin = require('firebase-admin');
const serviceAccount = require("C:/Users/santo/Downloads/bestmpos-firebase-adminsdk.json");
admin.initializeApp({
credential: admin.credential.cert(serviceAccount)
});
let fs = admin.firestore();
let auth = admin.auth();
start();
async function start (uid, userRecord){
const info = await fs.collection('users').doc(uid).get();
console.table(info.data());
document.getElementById("greeting").innerHTML = "Bonjour";
}
Html code:
<script type="text/javascript" src="app3.js"></script>
<body>
<p id="greeting">Hello</p>
</body>
when I wanted to pass bonjour value by using getElementById() there is a error saying that document.getElementById("greeting").innerHTML = "Bonjour";
ReferenceError: document is not defined
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
