Skip to content

Instantly share code, notes, and snippets.

@kruxor
Created November 6, 2015 02:54
Show Gist options
  • Save kruxor/ad26748fc60a871adecd to your computer and use it in GitHub Desktop.
Save kruxor/ad26748fc60a871adecd to your computer and use it in GitHub Desktop.
Load content into a div with jQuery
<div id="content">..</div>
<button onclick="$('#content').html(content);">click it</button>
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.";
$('#content').html(content);
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment