Remove All title="" Attributes

I’ve searched extensively for this.

Unfortunately after trying many solutions nothing has yet to work.

I’m looking for a JavaScript (not jQuery) that will seek and destroy any and all a link title tags and take absolute precedence over any other scripts/functions.

Thanks, Bryan

Something like this should work:
var links = documentgetElementsByTagName(‘a’);

var i = 0, iMax = links.length;

while(i < iMax) {
var parentElem = links[i].parentNode;

That would delete all the <a> tags and their content and not just title attributes. (or it would if it had a dot after document in the first line and didn’t have an extra } in the middle of the loop).


var links = document.getElementsByTagName('a');
var i = links.length;
while (0 < i) links[--i].title = '';

I tried yours and I also tried:

var links = document.getElementsByTagName('a');
var i = links.length;
while (0 < i) links[--i].title="";

No go. Perhaps it needs to be set to execute only after the page has loaded?

Thanks, Bryan

Yes. You can’t update the content of a web page from JavaScript until after that content has loaded. (That’s why it is now common to add the script tag immediately before the </body> so that the page loads first).

Thanks. Okay, it’s in place now.

I think it’s conflicting with another script. Is there any way to command precedence with JS like you would use the


deceleration with CSS?

Thanks, Bryan

That’s controlled by the order the scripts run in. Whichever script runs last wins.

Right, that’s what I always assumed.

Maybe the JS syntax needs to be able to handle the way these links are setup then, example link:

<a title="FAQs" href="faqs.php"><span style="">FAQs</span></a>

As you can see it throws the title right after a. Ideally, the best fix would be to stop the function that’s auto adding titles in the first place only it’s obviously deep in the core code or in one of thousands of files.

I’ve searched for hours for that answer to no avail so I’m now trying to cover up / workaround the problem.

Thanks, Bryan

More eyes makes problems more transparent.

Link us through to a test version of the page, and we’ll quickly find out what’s causing that to happen.