How can I return to a input type txt a variable value?



I have a app that make a registration. The users save your preferencies. I can save this information in Firebase and read the information in the Firebase and save in a variable, but I can’t return this value to a txt field in the html code. I don’t know how can I do this.

html code

Javascript code
return firebase.database().ref(‘Mirror/’ + uid).once(‘value’).then(function(snapshot) {
usernames = snapshot.val().NOME;



bind [value] to the input type text.


I got it using id, but not work perfectly.

in the html I put the id

and in javaScript I find the id and set a variable.
document.getElementById(‘meuID’).value = usernames

With this the information show in the input text, but when I try to save the information in the firebase agian the model are null. I believe tht this forms it’s only to show not save the informatiob. Can you help me??