lcor
asked on
Javascript remove <a> tag Firefox issue
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("s pacer").in nerHTML;
var winprint = window.open("", "", sOption);
winprint.document.write(ht ml);
The answer was
winprint.document.write(ht ml.replace (/<a[^>]*> (.*?)<\/a> /gi,'$1')) ;
I tried it on Internet Explorer and it works but does not work on Firefox 10.
Any ideas why and how to fix?
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("s
var winprint = window.open("", "", sOption);
winprint.document.write(ht
The answer was
winprint.document.write(ht
I tried it on Internet Explorer and it works but does not work on Firefox 10.
Any ideas why and how to fix?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Do you need to remove only the tags or the whole node including text between the tags?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
To answer question, just want the <a tag removed, not the text.