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

  • SEARCH
  • Home
  • 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 4049388
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T13:56:20+00:00 2026-05-20T13:56:20+00:00

Im not sure why this isn’t working, and with my limited jquery abilities I

  • 0

Im not sure why this isn’t working, and with my limited jquery abilities I havent been able to located the source of the issue. The script below removes everything instead of just the parent element.

Id appreciate some help with this.

Thanks, Lea

Script:

    // Delete post
    $('a.delete').livequery("click", function(e){

    if(confirm('Are you sure you want to delete this post?')==false)

    return false;

    e.preventDefault();

    var parent  = $('a.delete').parent();

    var temp    = parent.attr('id').replace('record-','');

    var main_tr = $('#'+temp).parent();

        $.ajax({

            type: 'get',

            url: 'delete.php?id='+ parent.attr('id').replace('record-',''),

            data: '',

            beforeSend: function(){

            },

            success: function(){

                parent.fadeOut(200,function(){

                    main_tr.remove();

                 });

            }

        });

    });

Markup:

<span id="posting">
<div class="friends_area" id="record-23">
       <img src="temp/user_icon.gif" style="width: 50px; height: 48px; float: left;" alt="">

           <label style="float: left;" class="name">

           <b>99Points</b>

           <em>ry ewst yewsrtg eswtg</em>

           <br clear="all">

           <span style="font-weight: normal;">
           9 minutes ago
           </span>
           <a href="javascript: void(0)" id="post_id23" class="showCommentBox">Comments</a>

           </label>
                    <a style="display: none;" href="#" class="delete"> Remove</a>

                    <br clear="all">
            <div id="CommentPosted23">
                            </div>
            <div class="commentBox" id="commentBox-23" style="display: none;" align="right">
                <img src="small.png" class="CommentImg" style="float: left;" alt="" width="40">
                <label id="record-23">
                    <textarea class="commentMark" id="commentMark-23" name="commentMark" cols="60"></textarea>
                <div>Write a comment...&nbsp;</div></label>

                <br clear="all">
                <a id="SubmitComment" class="smallbutton"> Comment</a>
            </div>
       </div>
           <div class="friends_area" id="record-22">

       <img src="temp/user_icon.gif" style="width: 50px; height: 48px; float: left;" alt="">

           <label style="float: left;" class="name">

           <b>99Points</b>

           <em>hywr ywerywersywrsey ry r</em>
           <br clear="all">

           <span style="font-weight: normal;">
           9 minutes ago
           </span>
           <a href="javascript: void(0)" id="post_id22" class="showCommentBox">Comments</a>

           </label>
                    <a style="display: none;" href="#" class="delete"> Remove</a>
                    <br clear="all">
            <div id="CommentPosted22">
                            </div>
            <div class="commentBox" id="commentBox-22" style="display: none;" align="right">
                <img src="small.png" class="CommentImg" style="float: left;" alt="" width="40">

                <label id="record-22">
                    <textarea style="overflow: hidden; color: rgb(51, 51, 51);" class="commentMark" id="commentMark-22" name="commentMark" cols="60"></textarea>
                <div style="position: absolute; display: none; font-weight: 400; width: 300px; font-family: monospace; line-height: 14px; font-size: 11px; padding: 0px;">Write a comment...&nbsp;</div></label>
                <br clear="all">
                <a id="SubmitComment" class="smallbutton"> Comment</a>
            </div>
       </div>

        <div id="bottomMoreButton">
    <a id="more_10" class="more_records" href="javascript: void(0)">Older Posts</a>
    </div>
                </span>
  • 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-05-20T13:56:21+00:00Added an answer on May 20, 2026 at 1:56 pm

    use $(this) instead of the class selector :). Right now you are removing all of the items with that class.

    var parent  = $(this).parent();
    

    Also, be wary that you cannot use $(this) in the ajax call (because it will refer to the ajax call), so you are (accidentally?) doing the right thing by storing it in a variable and the calling .remove() on it.

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

Sidebar

Related Questions

I'm not sure why this isn't working: import re import csv def check(q, s):
I'm not sure why this isn't working. I don't have any errors, but what
not sure why this isn't working-- i have 3 divs where the two on
I'm not sure why this isn't working as it is working in another area
I'm not sure why this isn't working. I have a record list of text
Not sure why this isn't working... I have several DIVs with an class of
Not sure why this isn't working. It was working perfectly and then I restarted
I'm not sure why this isn't working today, I've done very similar a few
Not sure why this isn't working. I have a timer defined, which runs a
Not sure why this isn't working. When people click the 'edit' button of my

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.