-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.html
39 lines (39 loc) · 928 Bytes
/
example.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<!DOCTYPE html>
<html>
<head>
<title>jQuery.htmlFromScript Example</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="jquery.htmlFromScript.js"></script>
</head>
<body>
<section id="wrapper">
<header>
<h1>What's your choice?</h1>
</header>
<ul>
<li><a href="#option-1">Choose option 1</a></li>
<li><a href="#option-2">Choose option 2</a></li>
</ul>
</section>
<script type="text/html" id="option-1"><![CDATA[
<article>
<h2>Option 1</h2>
<p>You have chosen option 1.</p>
</article>
]]></script>
<script type="text/html" id="option-2"><![CDATA[
<article>
<h2>Option 2</h2>
<p>You have chosen option 2.</p>
</article>
]]></script>
<script>
$(function () {
$("a").click(function (e) {
$('article').remove();
$('#wrapper').appendFromScript($(this).attr('href'));
});
});
</script>
</body>
</html>