-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjquery_example.html
More file actions
51 lines (43 loc) · 1.45 KB
/
Copy pathjquery_example.html
File metadata and controls
51 lines (43 loc) · 1.45 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>jQuery</title>
<link rel="stylesheet" href="../css/tomorrow-night-bright.css" />
<link type='text/css' rel='stylesheet' href='../css/styles.css' />
</head>
<body>
<h1>jQuery example</h1>
<button id="button1" class="btn-large">Action button</button>
<h2>Register event handler:</h2>
<pre><code class="register_event js">$('#button1').on('click', handle_button1_click );</code></pre>
<button id="button2" class="btn-large">Show code to run</button>
<div id="button1_info" style="display: none;">
<h2>Function on click:</h2>
<pre><code class="function_def"></code></pre>
</div>
<script type="text/javascript" src="../js/lib/jquery.js"></script>
<script type="text/javascript" src='../presentation/plugin/highlight/highlight.js'></script>
<script type="text/javascript">
hljs.initHighlightingOnLoad();
$(document).ready(function() {
$('#button1_info .function_def').html($('#handle_button1_click').html());
console.info("Ajax example");
$('#button1').on('click', handle_button1_click );
$('#button2').on('click', function (ev) {
console.log("Button 1 is clicked");
$('#button1_info').show();
});
});
</script>
<script type="text/javascript" id="handle_button1_click">
var handle_button1_click = function (ev) {
$(this).css({
"color": "#fff",
"background-color": "#000"
}).text("Button has been clicked");
};
</script>
<p style="height:800px"> </p>
</body>
</html>