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 3312068
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:57:02+00:00 2026-05-17T21:57:02+00:00

I am making an inline comment reply system It’s mostly working except that I

  • 0

I am making an inline comment reply system

It’s mostly working except that I cannot seem to apply a .remove() to the DIV’s created by my reply link – to “cancel” the reply

My jQuery code is:

    <script type="text/javascript">
    $(function() {
        <!-- jQuery inline replies -->
        $("a.reply_link").click(function(){
            this_id = this.id;
            $("#reply_link_div" + this_id).after('<div id="reply_div' + this_id + '" class="reply_div"><form method="post" action="<?php echo SITE_URL . "/comment"; ?>">'+
                                                 '<input type="hidden" name="post_id" value="<?php echo $view[0]['id']; ?>" />'+
                                                 '<input type="hidden" name="post_slug" value="<?php echo $_REQUEST['post']; ?>" />'+
                                                 '<input type="hidden" name="comment_thread" value="' + this_id + '" />'+
                                                 '<strong>reply</strong><div style="padding-bottom:4px;">'+
                                                 '<textarea name="comment_text" id="comment_text' + this_id + '" rows="1" style="width:100%;" /></textarea>'+
                                                 '</div><input type="submit" name="submit" value="submit" />&nbsp;&nbsp;&nbsp;<a href="#" class="reply_cancel_link" id="' + this_id + '">cancel</a></form></div>')
            $("#reply_link_div" + this_id).hide();
            return false;
        });

        <!-- jQuery reply cancel -->
        $('a.reply_cancel_link').click(function() {
            this_id = this.id;
            $('#reply_div' + this_id).remove();
            $("#reply_link_div" + this_id).show();
            return false;
        });
    });
    </script>

My HTML/PHP code is:

<table class="comment_table">
    <tr class="comment_text_outer_tr"><td colspan="4" class="comment_text_td">Comment text blah blah
    <div id="reply_link_div<?php echo $comment_id; ?>"><a href="#" id="<?php echo $comment_id ?>" class="reply_link" style="float:right;">reply</a></div>
    </td></tr>
</table>

When the user clicks the “reply” text, jQuery draws a reply_div underneath, inside this div is a link to “cancel” the reply

When the user clicks the cancel link, it should run the code under “jQuery reply cancel”, which is supposed to .remove() the associated reply_div

When I click cancel, nothing happens and there are no errors

Can you see what’s wrong with my code? Thanks

  • 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-17T21:57:03+00:00Added an answer on May 17, 2026 at 9:57 pm

    the “.click()” in jquery is a short-cut for “.bind(‘click’, handler)” link text

    you should use a “.live(‘click’, handler)” for dynamically created elements.

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

Sidebar

Related Questions

I'm making a theme that has inline CSS as a first website at http://flexibilitytheme.tumblr.com/
The problem: making a very simple style switcher with js (without inline event handling).
Making an adobe flex ui in which data that is calculated must use proprietary
Making UML sequence diagram in VS 2010RC I've observed that there is no activation
Making websites that appear correctly in IE is a big problem. Is there any
I'm making a task-based program that needs to have plugins. Tasks need to have
I am making this web site http://www.christopherbier.com/gbg/locations.html In safari on mac the content div
Can making function inline in some specific cases lower the overall performance of application?
I have couple of inline images within a div I can't get the div
I'm making a scrolling comment section, it works by having several elements echoed by

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.