-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
80 lines (69 loc) · 2.47 KB
/
index.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<!doctype html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>Joe's test</title>
<style type="text/css">
.blue { color: blue }
</style>
<script type="text/javascript" src="joe/joe.min.js"></script>
<script type="text/javascript">
//joe.fn.attach(window, "load", function() {
$(function() {
var p = $("p");
console.log(p);
//p.css({color: "red"});
//console.log(p.text());
//$(".ui-link:nth-of-type(2n+1)").css({backgroundColor: "blue", color: "white"});
$("a").each(function(idx) {
var e = $(this);
e.html(idx + ". " + e.html());
});
// on-click with navigation canceled
$("#l2").on("click", function(e) {
alert("link 2");
return false;
});
// prevent default
$("#l3").on("click", false);
// toggle classes via button
$("#b1").on("click", function() {
var p = $("p"), cls = "blue";
if (p.hasClass(cls)) {
p.removeClass(cls);
} else {
p.addClass(cls);
}
});
// show/hide elem
$("#b2").on("click", function() {
$("p").hide();
});
$("#b3").on("click", function() {
$("p").show();
});
$("#at").on("click", function() {
console.log($("p").attr("class"));
$.ajax({
url: "http://lynx/joe/index.html",
data: {key1: "value1", key2: "value2"},
success: function(data) {
console.log(data);
}
});
});
});
</script>
</head>
<body>
<p class="intro para">Introductionary paragraph.</p>
<a id="l1" class="ui-link" href="#">First link</a><br>
<a id="l2" class="ui-link" href="#">Second link</a><br>
<a id="l3" class="ui-link" href="#">Third link</a><br>
<br>
<button id="b1" type="button">Do something</button><br>
<button id="b2" type="button">Hide</button><button id="b3" type="button">Show</button><br>
<br>
<button id="at" type="button">Attr</button><br>
</body>
</html>