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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T15:26:33+00:00 2026-06-08T15:26:33+00:00

I have a row inside of a table in html that is hooked up

  • 0

I have a row inside of a table in html that is hooked up to the following JavaScript function:

<script type='text/javascript'>
        $(window).load(function () {
            $(".clickable").click(function () {

                $(this).next().toggle();

            });
        }); 

This function expands some content directly below this row. I also have a link in this row that is used to click through to another page. It looks like this:

enter image description here

When I click the link it will quickly expand the content right before it navigates to the page that it is supposed to go to.

How can I change it so that if the link is clicked, it goes to that page without calling the JavaScript function that expands the extra content?

  • 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-08T15:26:34+00:00Added an answer on June 8, 2026 at 3:26 pm

    On the link, you want to stop propagation:

    $('.myNavLink').click(function(e){
       e.stopPropagation();
    });
    

    Doc link: http://api.jquery.com/event.stopPropagation/

    EDIT As you’re having trouble implementing this here is a live example:

    http://jsfiddle.net/Vs5B8/

    You’ll see it has a table with 1 row, with a link in one of the cells:

    <table>
        <tr class="clickable">
            <td> one </td>
            <td> two </td>
            <td> <a href='http://www.google.co.uk' class="myNavLink"> click me </a> </td>
        </tr>
    </table>
    

    I have hooked up a click event on the row:

    $('.clickable').click(function(){
       alert("row click");
    });
    

    Therefore a click anywhere in the row will alert row click, and even do so when you click the hyperlink. However adding a click event to the a to stop propagation will stop this behaviour (ie, not show the alert when clicking the link):

    $('.myNavLink').click(function(e){
       e.stopPropagation();
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table inside a form that looks as follows: <td><input type=text name=code[0]
I have a table-row that has a JavaScript action attached to mouse clicks anywhere
Consider the following HTML table: <table id=myTable1> <tr id=TR1> <td><input type=text id=quantity1 name=quantity1 /></td>
I have a function in php that builds an html string for a table
I have a function that gets the contents of a table row and displays
I have a drop down box for each row inside a table <table> <tr>
I have following UI hierarchy Scroll View -->TableLayout-->Rows [each row has TextView+EditText] Problem Inside
I have a HTML table with a column per row with this html code
i have an html table inside a form in an asp.net mvc view. I
I have a sortable table in html and looking to put an add.png inside

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.