-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
52 lines (52 loc) · 1.63 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
<!DOCTYPE html>
<html>
<head>
<title>Input Field Redesign</title>
<link rel="stylesheet" type="text/css" href="css/normalize.css">
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body class="center">
<header>
<h2>Input Field Redesign</h2>
<p>Designed by Angela and Tiffany</p>
</header>
<div class="container">
<section class="content">
<span class="input">
<input class="input__field" type="text" id="input1">
<label class="input__label" for="input1">
<span class="input__label-content input__label-content" data-content="First Name">First Name</span>
</label>
</span>
<span class="input">
<input class="input__field" type="text" id="input2">
<label class="input__label" for="input2">
<span class="input__label-content input__label-content" data-content="Last Name">Last Name</span>
</label>
</span>
<span class="input">
<input class="input__field" type="text" id="input3">
<label class="input__label" for="input3">
<span class="input__label-content input__label-content" data-content="Email">Email</span>
</label>
</span>
</section>
</div>
</body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script>
$(".input__field").each(function (i, val) {
// If input field is clicked
$(val).on("focus", function () {
$(this).parent().addClass("input--filled");
});
// Input field is not focused
$(val).on("blur", function () {
// restore to normal state if input box is empty
if ($(val).val() === '') {
$(this).parent().removeClass("input--filled");
}
});
});
</script>
</html>