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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:23:30+00:00 2026-05-14T03:23:30+00:00

How do I remove links from a webpage with JavaScript? I am using Google

  • 0

How do I remove links from a webpage with JavaScript? I am using Google Chrome. The code I tried is:

function removehyperlinks() {
    try {
        alert(document.anchors.length);
        alert(document.getElementsByTagName('a'));
        for(i=0;i=document.anchors.length;i++) {
            var a = document.anchors[i];
            a.outerHTML = a.innerHTML;
            var b = document.getElementsByTagName('a');
            b[i].outerHTML = b[i].innerHTML;
        }
    } catch(e) { alert (e);}
    alert('done');
}

Of course, this is test code, which is why I have the alerts and 2 things trying at the same time. The first alert returns “0” the second [Object NodeList] and the third returns “done”.

My html body looks like this:

<body onload="removehyperlinks()">
<ol style="text-align:left;" class="messagelist">
    <li class="accesscode"><a href="#">General information, Updates, &amp;   Meetings<span class="extnumber">141133#</span></a>
        <ol>
            <li><a href="#">...</a></li>
            <li><a href="#">...</a></li>
            <li><a href="#">...</a></li>
            <li><a href="#">...</a></li>
            <li><a href="#">...</a></li>
            <li><a href="#">...</a></li>
            <li><a href="#">...</a></li>
            <li><a href="#">...</a></li>
            <li start="77"><a href="#"">...</a></li>
            <li start="88"><a href="#">...</a></li>
            <li start="99"><a href="#">...</a></li>
        </ol>
    </li>
  </ol>
</body>
  • 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-14T03:23:31+00:00Added an answer on May 14, 2026 at 3:23 am
    function removehyperlinks() {
        try {
            for(i=0;i<document.anchors.length;i++) {
                document.anchors[i].outerHTML = document.anchors[i].innerHTML
            }
        } catch(e) { alert ("try2:" + e);}
    }
    function runner() {
        for(i=1;document.anchors.length > 0;i++) {
            //alert('run ' + i + ':' + document.anchors.length);
            removehyperlinks();
        }
    }
    

    This works. As I am in control of the content, I named all the anchors “link” using a simple search and replace. If you run it once, it takes out every other one. So I just had it repeat, as you can see, till they are all out.

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

Sidebar

Ask A Question

Stats

  • Questions 536k
  • Answers 536k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer {% with group.grab_bugs as distinct_bugs %} <h2>{{ group.name }}</h2> (Count:… May 17, 2026 at 1:28 am
  • Editorial Team
    Editorial Team added an answer Yes - in.defaultReadObject(). But you'd have to use readObject(..) not… May 17, 2026 at 1:28 am
  • Editorial Team
    Editorial Team added an answer Is there any way to specify SQL comments through JPA… May 17, 2026 at 1:28 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I've got a JSP Document (JSP in XML) nicely formatted and when the webpage
I have a javascript function defined somewhere in the middle of my html/php based
I am using yahoo pipes to get content matching a certian category from my
I'm not very elite when it comes to JavaScript, especially the syntax. So I'm
We have a Web application (ASP.NET) which displays in some page links to miscellaneous
I would just like to hide the link and keep the other links like
The website to see the error (click the home, models, etc links) : http://bit.ly/9AE2RI
I am somewhat new to using JPA -- I'll put that out there right
I've been asked to display the 'correct' time on our website which I frankly
I'm in the process of developing a website that makes use of JQuery's superfish.

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.