Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8897489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T00:21:30+00:00 2026-06-15T00:21:30+00:00

Using Meteor, I am trying to loop through and display a list of notes

  • 0

Using Meteor, I am trying to loop through and display a list of notes from a database with an option to delete each note.

Here is the HTML (using Handlebars.js)

<template name="Notes">
    {{#each NoteArr}}
        <div class="Note">
            <h2>{{Title}}</h2>
            <p>{{Body}}</p>
            <span class="deleteNote">Delete</span>
        </div>
    {{/each}}
</template>

And here is the client Javascript

Template.Notes.events = {
    "click .deleteNote" : function(){
        noteID = $('.deleteNote').parent().attr("id");
        Notes.remove({ID:noteID});
    }
};

This grabs the first instance of .deleteNote, so unless I’m trying to delete the first one, that won’t help. How can I grab the parent of the particular instance of .deleteNote that was clicked, not just the first one it finds?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T00:21:31+00:00Added an answer on June 15, 2026 at 12:21 am

    The reason why the first element is deleted is.. in your .click event, you are accesssing the div directly as $('.deleteNote').parent() which grabs the first node in the html which has a class .deleteNode.

    Now to remove the specific notes, from the collection: Every document in the collection has a unique _id attribute which is generated automatically. assign that unique _id of the document to the span element as <span id= "{{_id}}" class="deleteNote">Delete</span>.

    So the cilck event will look like:

     Template.Notes.events = {
        "click .deleteNote" : function(e){
            var noteID = e.currentTarget.id;
            Notes.remove({_id:noteID});
            }
       };
    

    And the template will look like:

    <template name="Notes">
        {{#each NoteArr}}
            <div class="Note">
                <h2>{{Title}}</h2>
                <p>{{Body}}</p>
                <span id= "{{_id}}" class="deleteNote">Delete</span>
            </div>
        {{/each}}
    </template>
    

    Untested code, but hope this will help solving your issue.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using meteor with the bootstrap package. (here is a chunk of code where
I'm trying to randomly grab about 20 random rows from a table, then using
I'm trying to create a meteor app using jquery UI features. However I'm not
I'm using Codeigniter 2. I'm trying to display some images using the background url
Using Meteor, I'm trying to perform an update like the following: Items.update(Session.get('selectedItem'), {'$set': {'directions.0.name':
I'm trying to use the html5 geolocation api with Meteor. I'm using: navigator.geolocation.getCurrentPosition(handle_geolocation_query); in
I'm using meteor. I'm wondering if theres a shorthand way to do batch updates
I am trying to ping a Socomec meter using the Modbus protocol, having researched,
I am using Meteor 4.2 (Windows) and I am always getting the update failed:
I'm trying to work out how to make this view for my database The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.