Skip to content

Instantly share code, notes, and snippets.

@Yves-T
Created February 21, 2016 11:53
Show Gist options
  • Save Yves-T/40466574de9645f79ebc to your computer and use it in GitHub Desktop.
Save Yves-T/40466574de9645f79ebc to your computer and use it in GitHub Desktop.
JQUERY: load templates
<h1 id="testHeader">BLABLA</h1>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<style>
#testHeader {
color: tomato;
}
</style>
</head>
<body>
<div id="selectedTarget">
Existing content.
</div>
<script type="text/javascript">
$(document).ready(function () {
$('#selectedTarget').load('includes/contentSnippet.html');
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment