Created
July 20, 2015 14:44
-
-
Save fandrefh/57a76f97362e7cafbc07 to your computer and use it in GitHub Desktop.
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 criaElemento(tag) { | |
var elemento = document.createElement(tag); | |
elemento.innerText = "Também funciona!!!"; | |
//elemento.onclick = obterAtributosDosElementos; | |
elemento.addEventListener("click", obterAtributosDosElementos); | |
document.getElementById('sec-elementos').appendChild(elemento); | |
} | |
function obterAtributosDosElementos() { | |
var select = document.getElementById("slc-dados-elementos"); | |
console.log(select); | |
var chaves = Object.keys(this); | |
console.log(chaves); | |
for (var i = 0; i < chaves.length; i++) { | |
var opcao = document.createElement("option"); | |
opcao.value = chaves[i]; | |
opcao.innerText = chaves[i]; | |
select.appendChild(opcao); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment