title: Unexpected token function in Firebase
body: <p>I'm using the Firebase chat from the tutorial and I added an additional key pair that will keep track of the "status" of each message in the form of a boolean:</p>
  
  <pre><code>myDataRef.push({
       name: name,
       text: text,
       status: false
  });
  </code></pre>
  
  <p>Here is the <a href="http://jsfiddle.net/eym49en2/1/" rel="nofollow">fiddle</a>.</p>
  
  <p>I'm looking to have the text change automatically when I change the value of status in the database. So if I change it to false for one message, that message turn red instead of the default green.</p>
  
  <p>Here is the bit that I am having trouble with: </p>
  
  <pre><code>var done = myDataRef.orderByChild('status').equalTo(true);
     done.on('child_added', function(function(snapshot) {
         var obj = snapshot.val();
         if(obj.status == true) {
             $('.text').attr('class', 'text red');
         }
  }); 
  </code></pre>
  
  <p>The code first runs through all the children looking for those that have the child "status" equal to true. Then it changes the attribute of the results by turning the text red. </p>
  
  <p>However, I am not exactly sure why but I am getting a: </p>
  
  <pre><code> Uncaught SyntaxError: Unexpected token function
  </code></pre>
  
  <p>I hope someone can help me out here! Thanks.</p>