Created
November 6, 2015 03:00
-
-
Save kruxor/d957cfa1df6976aac721 to your computer and use it in GitHub Desktop.
Load content into a div with javascript
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
<div id="content">..</div> | |
<button onclick='load_content(content);'>Load It</button> |
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
var content = "<style>a { color:#000;font-weight:bold; }</style>\ | |
<a href='#'>a test link</a><br>\ | |
a new line if needed<br>\ | |
another new line."; | |
function load_content(content) { | |
document.getElementById("content").innerHTML = content; | |
} | |
load_content(content); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment