开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜