Created
June 7, 2016 19:28
-
-
Save codenamejason/377aef639524d07e0b412c3612634fbc 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
// Add an image | |
function createImage() { | |
// Add to bottom of page(s) | |
var img = document.CreateElement('img'); | |
img.setAttribute("src", "/images/image.png"); | |
("id", ); | |
("width", "250"); | |
("height", "250"); | |
("style", ""); | |
// Adds to bottom of page(s) | |
document.body.appendChild('img'); | |
// Add to div | |
document.getElementById('my-div').appentChild('img'); | |
} | |
// Result: | |
// <div id="my-div"> | |
// <img id="MyImg" style-"" src="" width="250" height="250" /> | |
// </div> | |
// 2016 codenamejason |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment