Last active
August 29, 2015 14:17
-
-
Save jaywon/d265bb84c7e4ac709647 to your computer and use it in GitHub Desktop.
This file contains 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
//get a reference to the main element in your HTML document(DOM) | |
var mainElement = document.getElementById('main'); | |
for (var i = 0; i < window.geemails.length; i++) { | |
var x = document.createElement("P"); | |
var t = document.createTextNode(window.geemails[i].sender + " " + window.geemails[i].subject + " " + window.geemails[i].date); | |
x.appendChild(t); | |
//append to the main element to attach new element as a child of main instead of document.body | |
mainElement.appendChild(x); | |
} | |
//can do this once outside of the for loop since geemails.length won't change in the for loop so value stays the same | |
// inbox count | |
document.getElementById("count").innerHTML = "(" + geemails.length + ")"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment