开发者

Stop, Hide or Strip out the title="" Attribute [closed]

开发者 https://www.devze.com 2023-03-07 03:00 出处:网络
Closed. This question needs details or clarity. It is not currently accepting answers. 开发者_如何学CWant to improve this question? Add details and clarify the problem by editing this post
Closed. This question needs details or clarity. It is not currently accepting answers.
开发者_如何学C

Want to improve this question? Add details and clarify the problem by editing this post.

Closed 9 years ago.

Improve this question

In the WordPress core code is a rule to auto-create title="" attributes for links whether it's desired or not.

There appear to be some out-dated plugins that attempt to fix this that are no longer working so instead what I'm hoping is that there is some JavaScript to either block title="" auto-creation altogether or strip it out.

The reason I want to block out titles is because I'm using CSS tooltips that are getting covered by the browser default tooltips... that are only there because of WP auto-created titles.


First of, let me say that I completely agree with Gavin - removing the title attribute is counterproductive in getting your HTML to validate. Also I do not see a reason why you'd want to remove it.

That being said, this javascript does what you want:

<script type="text/javascript">
    window.onload = function() {
        var alinks = document.getElementsByTagName("a");
        for (var i = 0; i < alinks.length; i++) {
            alinks[i].removeAttribute("title"); 
        }
    }
</script>
0

精彩评论

暂无评论...
验证码 换一张
取 消