Skip to content

Instantly share code, notes, and snippets.

@Wilto
Created July 3, 2012 16:43
Show Gist options
  • Save Wilto/3040913 to your computer and use it in GitHub Desktop.
Save Wilto/3040913 to your computer and use it in GitHub Desktop.
Hide and Tel
(function() {
var links = document.getElementsByTagName( "a" );
for ( var i = 0, a = links.length; i < a; i++ ) {
if( links[ i ].href.indexOf( "tel" ) > -1 ) {
var el = links[ i ],
parent = el.parentNode,
num = document.createTextNode( el.innerHTML );
if( el.className.indexOf( "tel" ) === -1 || !parent.className.indexOf( "tel" ) === -1 ) {
parent.replaceChild( num, el );
}
}
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment