You can create a unordered list in your HTML:
<form onsubmit = "return a();">
<input type = "text" id = "name">
<input type = "text" id = "message">
<input type = "submit">
</form>
<ul id="dados">
</ul>
And use the Document.getElementById()
to display the data:
firebase.database().ref('SMS/').on('child_added', function(snapshot) {
var resultado = snapshot.val();
console.log(resultado);
var lista = document.getElementById('dados');
var linha = "<li>"+resultado.name+" : "+ resultado.message + "</li>";
lista.innerHTML = lista.innerHTML + linha;
});
Please return the code that was in question earlier. As it is now it is difficult to help you and the question runs the risk of not being answered or even being closed because it is too wide.
– Rosário Pereira Fernandes
Please reverse your changes. The code is critical so that users can understand and give a better solution to your problem.
– Valdeir Psr