I have a database in Firebase that receives data from an Android application, the application sends the data already enclosed in HTML tags, with classes and Id's. I get the Firebase data with Javascript and print it on the screen. the data is displayed correctly. But apparently it overwrites everything about the HTML file because the file I add an element h1 to give a title and when loading the project shows me the element h1 but then disappears and shows the data obtained from Firebase. He also does not let me give him styles, I select them with the classes with which the elements are coming but apparently he does not read them.
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://www.gstatic.com/firebasejs/live/3.1/firebase.js">
</script>
<script src="https://www.gstatic.com/firebasejs/4.6.2/firebase.js"></script>
<script src="referenceFirebase.js"></script>
<link rel="stylesheet" href="estilosPedido.css">
<title>Prueba</title>
</head>
<body>
<h1> Pedidos</h1>
<script src="pruebaPedido.js"></script>
</body>
</html>
---------------------- CSS ------------------------
* {
margin: 0;
padding: 0;
box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.divPedidos {
background: #FF8A33;
width: 10px;
height: 10px;
}
p {
background: #FF8A33;
font-size: 50px;
}
--------------------- archivo JS --------------------
var referenceMesa = databaseRefence.child('Mesa3');
var referencePedidos = referenceMesa.child('Pedidos');
var referenceUsuario = referencePedidos.child('Usuario1');
var referencePedido = referenceUsuario.child('Pedido1');
var pedido1;
referencePedido.once('value').then(function (snapshot) {
pedido1 = snapshot.val();
console.log(pedido1);
setTimeout(prueba, 1000);
});
function prueba() {
document.write(pedido1);
}