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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T07:52:19+00:00 2026-06-08T07:52:19+00:00

I have a web page with a table and a remove row link in

  • 0

I have a web page with a table and a “remove row” link in each row of the table.

Problem is, when I click to delete a row, the browser does a page refresh. How do I prevent his from happening?

Here’s a complete functioning HTML page. Try it, scroll down to the rows, click a link causes the scrollbar to jump back up to the top:

NOTE: I’m using Firefox 11.

<SCRIPT language="javascript">

function deleteRow(rowID) {
  try {
    var table = document.getElementById("mytable");
    var iRowIndex = 0;
    while (iRowIndex < table.rows.length) {
      var row = table.rows[iRowIndex];
      if (row.id == rowID) {
        table.deleteRow(iRowIndex);
      } else {
        iRowIndex++;
      }
    }
  } catch (e) {
    alert(e);
  }
}

</SCRIPT>

<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>


<table id="mytable">
  <tr id="foo" >
    <td>FOO</td>
    <td>
       <a href="#" onclick="deleteRow('foo')">remove</a>
    </td>
  </tr>
  <tr id="bar" >
    <td>BAR</td>
    <td>
       <a onclick="deleteRow('bar')">remove</a>
    </td>
  </tr>
</table>

Any ideas?

  • 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-08T07:52:20+00:00Added an answer on June 8, 2026 at 7:52 am

    The reason your page is refreshing is because of the href="#" in your anchor tag. Removing that should make your example work.

    Removing the href="#" snippet will also removing the selector cursor on hover of the anchor element. If you wish to maintain that styling, it’s easy to fix with a little css.

    .myAnchor:hover {
        cursor: pointer;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have web page in PHP which displays all records in a table. I
I have a web page that uses jquery ajax to grab the table markup
I have created a web page that displays a table. Most of the cells
I have created a web page that displays a table. Most of the cells
I have tried to find a table with class data in a web page
I'm working on a web page where I have a dynamically generated table where
The problem is: On postback, the table does not have the rows that were
I have web page which is passing a querystring parameter to page 2: <a
Alright, here is my problem i'm trying to solve. I have an index page
I have a web page which has a form at the top and a

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.