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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:48:55+00:00 2026-05-25T14:48:55+00:00

I have clickable row, that will fire link onclick event, but trigger() cause a

  • 0

I have clickable row, that will fire link onclick event, but trigger() cause a new click event on tr.clickable and go into loop. How to prevent this ?

<table>
    <tr class="clickable">
        <td>Test row</td>
        <td><a href="#" onclick="alert('click');" class="trigger"></a></td>        
    </tr>
</table>

js:

$('tr.clickable').click(function(){
    var trigger = $(this).find('a.trigger');
    trigger.trigger('click');
});

Live demo here.

  • 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-25T14:48:56+00:00Added an answer on May 25, 2026 at 2:48 pm

    This is down to event bubbling in JavaScript. It’s a bit of a weird setup you’ve got at the moment, but one way to fix it would be to stop the click event bubbling on the a tag:

    $('tr.clickable a').click(function (e) {
        e.stopPropagation();
    });
    

    Fiddle

    Alternately you could not fire the click trigger if the target event is the same element:

    $('tr.clickable').click(function(e){
        var trigger = $(this).find('a.trigger').not(e.target);
        trigger.trigger('click');
    });
    

    Fiddle

    The best way would probably be the first solution, I guess.

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

Sidebar

Related Questions

I currently have a table with rows that contain a clickable link. When a
I'm trying to delegate a click event to a TR element that contains a
My goal is to have the user be able to click the row and
I have a ListView that is fed by an SQLiteDB. On each row returned,
I have a MVC application and I want to make my table row clickable
I have an editable Jqgrid(where when im clicking on a row, that row get
I currently have a java script solution to make an entire table row clickable.
I am dynamically creating a table which I want to have clickable rows. When
I have a clickable TextView with a drawable as its background. I'm looking for
I would like to have formatted, clickable text and images inside a selected UITableViewCell.

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.