I have a textbox that receives realtime data from realtime firebase database. This is how the textbox is being updated
function getUpdate(id) {
var updatedRef = firebase.database().ref('operators/' + id);
updatedRef.on('value', function(snapshot) {
document.getElementById('txt_lastmsg').value = snapshot.child("msg").val();
});
}
window.onload = getUpdate(0);
The textbox is working properly and getting new data every time firebase is updated.
I tried to attached onChange
on the textbox but it is not being fired by the firebase update.
<input type="text" id="txt_lastmsg" onchange="javascript:alert('Hello World!')"><br>
How can I detect the firebase update on the textbox?
Thanks