Skip to content

Instantly share code, notes, and snippets.

@kaiquewdev
Created July 7, 2011 20:35
Show Gist options
  • Save kaiquewdev/1070482 to your computer and use it in GitHub Desktop.
Save kaiquewdev/1070482 to your computer and use it in GitHub Desktop.
Selecionar objetos
/*Alternar opções*/
function alternarOpt(menu, itens){
/*Esconde os itens*/
$(itens).css({visibility:"hidden"});
$(menu).bind('click', function(){
var item = $(menu).index(this);
var vItem = $(menu+':eq('+item+')').attr("value");
$(itens).css({visibility:"hidden"});
$(itens+'#'+vItem).css({visibility:"visible"});
console.log(vItem);
});
}
//Primeiro argumento:Select
//Segundo argumento:Div
alternarOpt('menuToSelect','ItemForModificate');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment