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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T22:48:23+00:00 2026-06-14T22:48:23+00:00

I am programming something that has two buttons with the same functionality. Rather than

  • 0

I am programming something that has two buttons with the same functionality.

Rather than putting all the information from the first button into the second one, I added an even handler to the second to trigger a click on the first so the same code will be run.

I’m using the jQuery framework so if possible could I get suggestions in jQuery format.

This is the code I was using for the event handler:

$(document).on('click', '.enlargeComments', function(){
    
    $(this).prev('.commentsLink').trigger('click');
    
});

The button with all the functionality is created by a PHP class, so getting the information to place it onto the second will not work, also giving it an identifying class would also mean making additional changes to the class which isn’t ideal to be honest.

However now I have another button which comes in between these two and my event handler no longer works… I need a solution to get my original one workings so no suggestions to change the way it’s currently working please.

  • 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-14T22:48:24+00:00Added an answer on June 14, 2026 at 10:48 pm

    You can use .prevUntil(sel).prev() to do this:

    $(document).on('click', '.enlargeComments', function(){
    
        $(this).prevUntil('.commentsLink').prev().trigger('click');
    
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Almost every ios app now has something like Feed option. Programming that usually includes
I'm trying to pick up Lua programming but I'm stuck on something that's probably
I'm new to event programming, and I'm obviously misunderstanding something that I'm trying to
Ever since I started programming this has been something I have been curious about.
We are programming a ST269 microcontroller which has two IR distance sensors. To calibrate
From examples that I have seen online and in a Programming Entity Framework CodeFirst
I know that each programming language has certain guideline and styles. My question is
I'm not sure if this is a proper programming question, but it's something that
I am programming something like e-mail for my users. I want to allow people
I'd like to start messing around programming and building something with an Arduino board,

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.