-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
39 lines (36 loc) · 1.13 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
<!DOCTYPE html>
<html>
<head>
<title>DIY Contact Card</title>
<link rel="stylesheet" type="text/css" href="style.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<script type = "text/javascript">
$(document).ready(function(){
$('form').submit(function(){
$('.row').append('<div class="box"><h1>' + $('input:first').val() + ' ' + $('input:nth-of-type(2)').val() + '</h1><p>' + $('textarea').val() + '</p><p>' + 'Click for Description' + '</p></div>');
$('p:first-of-type').hide();
return false;
})
$('form').on('click', 'input[type="submit"]', function(){
$('p:nth-of-type(2)').show();
})
$('.row').on('click', '.box', function(){
$(this).children('p:first-of-type').show();
$(this).children('p:nth-of-type(2)').hide();
})
});
</script>
</head>
<body>
<div id="container">
<div class="row">
<form>
First Name:<input type="text" value="First Name"><br>
Last Name:<input type="text" value="Last Name"><br>
Description<br><textarea rows="6" cols="30"></textarea><br>
<input type="submit" value="Add User">
</form>
</div>
</div>
</body>
</html>