Skip to content

Instantly share code, notes, and snippets.

@gabrielgilini
Created November 10, 2008 17:55
Show Gist options
  • Save gabrielgilini/23566 to your computer and use it in GitHub Desktop.
Save gabrielgilini/23566 to your computer and use it in GitHub Desktop.
if(document.getElementsByClassName){
var elementos =
document.getElementsByClassName('esconder');
for(var i = 0, j = elementos.length; i < j; i++){
elementos[i].style.display = 'none';
}
}else{
var elementos = document.getElementsByTagName('div');
var expressao = new RegExp("(^|\\s)esconder(\\s|$)");
for(var i = 0, j = elementos.length; i < j; i++){
if(elementos[i].className.match(expressao)){
elementos[i].style.display = 'none';
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment