-
Notifications
You must be signed in to change notification settings - Fork 2
/
examples.html
96 lines (77 loc) · 2.54 KB
/
examples.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
to me
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-3.2.1.min.js"
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
crossorigin="anonymous"></script>
<style>
.req {
border:1px solid red;
}
span {
display: block;
}
</style>
<script>
$(document).ready(function() {
console.log(document.getElementById('myDiv'));
$('#i1').blur(function() {
if ($('#i1').val().length > 2)
$('#i1').removeClass('req');
else
$('#i1').addClass('req');
});
$('#aa').click(function(e) {
e.preventDefault();
console.log('s');
});
//$('#myDiv').hide(2000).show(2000).hide(2000).show(2000).hide(2000).show(2000);
$('div span').each(function(k,v) {
let color = 'blue';
if (k%2==0) {
color ='red';
}
$(this).css('color', color);
});
});
</script>
<style>
.highlight {
background-color: yellow;
}
#myDiv {
width: 300px;
height: 300px;
margin:0 auto;
}
</style>
</head>
<body>
<div>
<span>xxxxxxxxxx</span>
<span>xxxxxxxxxx</span>
<span>xxxxxxxxxx</span>
<span>xxxxxxxxxx</span>
<span>xxxxxxxxxx</span>
<span>xxxxxxxxxx</span>
<span>xxxxxxxxxx</span>
<span>xxxxxxxxxx</span>
<span>xxxxxxxxxx</span>
<span>xxxxxxxxxx</span>
</div>
<div class='my-class' id='myDiv' style='background-color: red;'>
Hello there!
<a id='aa' href='http://localhost/jquery/'>Anchor</a>
</div>
<fieldset>
<legend>Inputs:</legend>
<label>First name
<input id='i1'>
</label>
<input id='i2'>
<input id='i3'>
<button id='c'>Click</button>
</fieldset>
</body>
</html>