Last active
August 18, 2016 13:08
-
-
Save gustavom/26c9da63e6700900e48ae6856e6b8f81 to your computer and use it in GitHub Desktop.
Prepend do Jquery em js puro
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
//define elemento container - com ID | |
var elementoContainer = document.getElementById("elementoContainerID"); | |
//define elemento para ser inserido no inicio | |
var elementoParaInserir = document.createElement('div'); | |
elementoParaInserir.classList.add('_elementoInserido'); | |
elementoContainer.insertBefore(elementoParaInserir, elementoContainer.firstChild); | |
//eu vi aqui: | |
// http://stackoverflow.com/questions/3391576/how-can-i-implement-prepend-and-append-with-regular-javascript |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment