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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T12:43:15+00:00 2026-05-18T12:43:15+00:00

I created some ajax paginated comments in WordPress. Unfortunately, if the user had clicked

  • 0

I created some ajax paginated comments in WordPress. Unfortunately, if the user had clicked on the reply button and then goes about to click on another comment page, the Comment Form vanishes into thin air.

Anyways, simple question: Triggering the “Cancel Reply” function from my code each time the user clicks on a new ajax page would effectively solve the problem by causing the form to jump back to the original position.

How can I trigger cancel.onclick() from my own code easily? I was going to just duplicate commands and create a new function, but thought there might be an easier way to save a few bytes!

Here’s the source code:
http://core.trac.wordpress.org/browser/trunk/wp-includes/js/comment-reply.dev.js

  • 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-18T12:43:15+00:00Added an answer on May 18, 2026 at 12:43 pm

    Try something like this:

    $('#id_of_your_cancel_button').click();
    // same thing as $('#id_of_your_cancel_button').trigger('click');
    

    If the “cancel” logic is to be used in multiple contexts, perhaps it would be best if it lives in its own named function declaration, rather than the anonymous function expression as in your example. This would give you the option of doing something like this:

    function myCancelCode(){
      do_stuff();
    }
    

    Then in your addComment object:

    cancel.onclick = myCancelCode;
    

    and from anywhere else:

    if( somethingHappens ){
      myCancelCode();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to pass a dynamic, user created object through AJAX to some C#.
I created some tables using MySQL Workbench, and then did forward ‘forward engineer’ to
I have this jQuery ajax navigation tabs plugin that I created using some help
I have some divs created dynamically this way: //here goes some loop, and everything
I've got an ajax call returning some html. The html is created and returned
I have created a custom widget which has a link to some ajax functionality.
I created an autosuggest script using php, ajax and some css but I can't
I want to create some kind of AJAX script or call that continuously will
I created some widgets with jQuery UI and I notice that buttons have a
I have created some extra functionality on my Linq-to-SQL classes to make things easier

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.