Javascript remove <a> tag Firefox issue

Posted on 2012-08-13
Last Modified: 2012-08-15
This is a followup to a question I asked.  Here's the question:
I have a javascript function for a printer friendly page.  The only problem is that hyperlinks show up in the printer friendly page.  I need the text within the <a> tags without the links.

How do I remove just the <a> tags from document object?  Please, no CSS -- I need to get the javascript below working.

Here's the javascript code:

var html = document.getElementById("spacer").innerHTML;
var winprint ="", "", sOption);


The answer was


I tried it on Internet Explorer and it works but does not work on Firefox 10.

Any ideas why and how to fix?
Question by:lcor
    LVL 74

    Accepted Solution

    You might try:


    Open in new window

    LVL 11

    Expert Comment

    Do you need to remove only the tags or the whole node including text between the tags?
    LVL 42

    Assisted Solution

    by:Chris Stanyon
    CSS is probably the best option for you, so not sure why you wouldn't want to use that!

    Here's an easy jQuery way to do it.


    Open in new window


    Author Comment

    To answer question, just want the <a tag removed, not the text.

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Join & Write a Comment

    I recently found myself in a Corporate Situation where the client had requested blocking access to any and all websites except his own Domain? Easy? I am sure this would be your answer but their requirement was, this has to be done without using…
    #Citrix #Internet Explorer #Enterprise Mode #IE 11 #IE 8
    The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
    How to create a custom search shortcut to site-search Experts Exchange using Google in the Firefox browser. This eliminates the need to type out whenever you want to search the site. Launch your Bookmark Menu: Press 'Ctrl +…

    731 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now