Created
July 21, 2015 16:54
-
-
Save brunobar79/9e8ef5d6d559c0f1cc78 to your computer and use it in GitHub Desktop.
block empty links
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function blockEmptyLinks(){ | |
| var links = document.getElementsByTagName("a"); | |
| for(var i=0; i< links.length; i++){ | |
| var url = links[i].getAttribute("href"); | |
| if(url!== null && url===""){ | |
| links[i].style.pointerEvents = "none"; | |
| }; | |
| } | |
| }; | |
| blockEmptyLinks(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment