June 11, 201016 yr Hello, I know nothing about javascript. And I have this script: <script type='text/javascript'> window.onload = function() { para = document.getElementById('my_id').getElementsByTagName('a'); if(para.length) for(index in para){ para[index].removeAttribute('title'); } } </script> I need it to work by "class" and not "id". Could someone rewrite it for me?
June 11, 201016 yr Author I've always used this http://robertnyman.c...name-anno-2008/ Jesus! I have no idea how to use it ...
June 11, 201016 yr Include that script, and afterwords use this. Should theoretically work. <script type='text/javascript'> window.onload = function() { para = document.getElementsByClassName('my_class').getElementsByTagName('a'); if(para.length) for(index in para){ para[index].removeAttribute('title'); } } </script>
June 12, 201016 yr Author Fail... I downloaded the script "ByClassName" on this link: http://code.google.com/p/getelementsbyclassname/downloads/list. My html: <html> <head><title>Title of hell</title> <script src="getElementsByClassName-1.0.1.js" type="text/javascript"></script> <script type='text/javascript'> window.onload = function() { para = document.getElementsByClassName('my_class').getElementsByTagName('a'); if(para.length) for(index in para){ para[index].removeAttribute('title'); } } </script> </head> <body> <ul class="my_class"> <li><a title="Title of hell" href="#">Title of hell</a> </ul> </body> </html>
June 12, 201016 yr Author Still not working ... Just to clarify. This script removes the title attribute to all tags <a> contained in all elements with "id" mentioned. I did what I asked. But I need it to act in <ul>. Because it works with the getElementById in <ul>.
June 22, 201016 yr Author Use jQuery - problem solved. But I need a solution that does not use libraries ... I am a layman in JS. But I believe that this is not to be so complicated for experienced users.
Create an account or sign in to comment