title: Making web form for updating data in Firebase
body: <p>I am making an interface to manipulate data in Firebase. I managed to make a form that inserts new data, I have a list of retrieved data, the only thing that is missing is editing/updating existing data.</p>
  
  <p>I am using Foundation 6 to speed up coding HTML and CSS and I created a modal that pops up when you click on a name. Also, I made that every name has a class that is their child key in Firebase so I can open data for the right item. I've stuck here and I don't know how to make that form in modal to fill data from clicked name. Can somebody help me a bit?</p>
  
  <p><a href="https://i.stack.imgur.com/nzDPT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nzDPT.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/b88Fq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/b88Fq.png" alt="enter image description here"></a></p>
  
  <p>Here is my code:</p>
  
  <pre><code>      var ref = new Firebase("https://myname.firebaseio.com/data/users");
          ref.on("child_added", function(snapshot) {
            var key = snapshot.key();
            var data = snapshot.val();
            var name = data.name;
            var city = data.city;
            $("#results").append($("&lt;li class=\"" + key + "\"&gt;" + "&lt;a data-open=\"modal\"&gt;" + name + ", " + city + "&lt;/a&gt;&lt;/li&gt;"));
            // this is for filling up the form with loaded data
            $(".name").val(name); 
            $(".name").focus(function(){
                $(this).val(name);
            });
          });
  </code></pre>