开发者_如何学C
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this questionIn 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>
精彩评论