How would i convert this Jquery code into meteor friendly code

not sure how to convert this jquery code into meteor.

   `<button class="follow">follow</button>
   <div class="col-md-6"><h1><br>Following</h1>
   <table class="table table-bordered table-condensed">
     <thead><tr> <td><b>gfdjhhjj</b></td> </tr></thead>
      <ul id="followingOutput"></ul>


$(function() {
          var output = $("#followingOutput").on("click", "li", function () {
          $(".follow").on("click", function () {
              output.append("<button class=deleteButton>&times;</button><br>");

my attempt at converting

 "click #followingOutput" : function(event) {
    "output" : function () {

"click .follow" :function(event) {

In Meteor you do not manipulate the DOM yourself but use Reactivity. The simplest example would be with using (global) Session variables and collections. In your example, where are the list items in #followingOutput coming from?

i wanted #followingOutput to add to a list somewhere else on the same page when you click a button, the way it is now you can click the button infinity and doing so adds nothing but a x button that deletes that same input, but this is more of a “does it work” type of thing instead of being practical.

what i want the meteor code to do is add that x to a list and when that x is clicked to delete what it just added which is basically what the jquery code it doing.


should look like


in order for it to work properly.

well, better define array representing the data behind that table rows
and than you can remove it from array and it will get removed from DOM

as already mentioned, do not manipulate DOM itself, manipulate the data it represents
as in TODO example

Lookup the use of pub/sub, collections and helpers in the Meteor documentation. I also recommend to check out at least one of the Meteor examples