Javascript remove <a> tag Firefox issue

Posted on 2012-08-13
Medium Priority
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 = window.open("", "", 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 75

Accepted Solution

käµfm³d   👽 earned 1600 total points
ID: 38289908
You might try:


Open in new window

LVL 11

Expert Comment

ID: 38291299
Do you need to remove only the tags or the whole node including text between the tags?
LVL 45

Assisted Solution

by:Chris Stanyon
Chris Stanyon earned 400 total points
ID: 38292423
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

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

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
Google currently has a new report that is in beta and coming soon to Webmaster Tool accounts. This Micro Tutorial will highlight new features for Google Webmaster Tools.
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 site:experts-exchange.com whenever you want to search the site. Launch your Bookmark Menu: Press 'Ctrl +…
Suggested Courses

850 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