Firebase viewing the specific child on the list. Website

Home / javascript / Firebase viewing the specific child on the list. Website

How to view the specific child on list on my JavaScript.

My code:var rootRef = firebase.database().ref().child("tutee");

rootRef.on("child_added", snap =>

var sno = snap.child("studentnumber").val();
var fname = snap.child("firstname").val();
var lname = snap.child("lastname").val();
var email = snap.child("email").val();
var key = snap.key;
var view = snap.key;
var btn = "";
var btnview = "";


"+sno+" "+fname+" "+lname+" " + btn + " " + btnview + "


/* Delete */

$(‘#table_body’).on(‘click’, ".removeEmployee", function(){ // note: using
‘removeElement’ as class, not as id
var key = $(this).attr(‘key’);
var itemToRemove = rootRef.child(key);
.then(function() { // removed from Firebase DB
console.log("Remove succeeded.")
alert("Successfully remove.");
.catch(function(error) {
console.log("Remove failed: " + error.message)

// keeping this separate so that even if the item is removed by any other
means (e.g.- directly from server console) this UI will remain in sync
rootRef.on(‘child_removed’, function(snap) {
var key = snap.key;

I want to click the view button, then it will go to the information of the child where I click it.

I think you want to retrieve the data on view button’s click. If so , you can put the following code under view button’s click function.
var key = $(this).attr(‘view’);
firebase.database().ref("tutee/" + key).once("value", snap =>{
var sno = snap.val().studentnumber;
var fname = snap.val().firstname;
var lname = snap.val().lastname;
var email = snap.val().email;

Read this , retreiving data from firebase.
Read more

Leave a Reply

Your email address will not be published. Required fields are marked *