Tweet UI - class tweet

PHOTO EMBED

Sun May 30 2021 01:35:39 GMT+0000 (UTC)

Saved by @ejiwen

$(document).ready(function(){

  var $app = $('#app');
  $app.html('');

  var feed = $( '<div id="feed"></div>' );
  feed.appendTo("#app");

  var updateFeed = $('<button id="update-feed">Update Feed</button>');
  updateFeed.appendTo("#app");



  var renderFeed =  function(){
    $("#feed").html("");
    var index = streams.home.length - 1;
    while(index >= 0){
      var tweet = streams.home[index];
      var $tweet = $('<div class="tweet"></div>');
      $tweet.text('@' + tweet.user + ': ' + tweet.message);
      $tweet.appendTo('#feed');
      index -= 1;
    }
    }

  renderFeed();

  $( "#update-feed" ).on("click", function() {
    renderFeed();
  })



});
content_copyCOPY