The sites are not showing on my site which im adding

here is my code


import { Template } from ‘meteor/templating’;
Websites = new Mongo.Collection(“websites”);
import ‘./main.html’;

Template.addsiteform.events({
‘click.js-add-site’:function(event){
var url= $(‘#url_input’).val();
var site= {“url”:url};
console.log(“site”);
websites.find(site);
return false;
}
});
Template.sitelist.helpers({
‘all_websites’: function(){
return websites.find({});
}
});

I think there was a space missing between click and the CSS class .js-add-site

Template.addsiteform.events({
 'click .js-add-site': function(event, template){
   var url= template.$(’#url_input’).val();
   var site= {“url”:url};
   console.log( websites.find(site) );
   return false;
  }
});

Also, when posting code put it btween ``` code ```` to make it more readable

1 Like