File tree Expand file tree Collapse file tree 3 files changed +96
-0
lines changed
Expand file tree Collapse file tree 3 files changed +96
-0
lines changed Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
2+ < html lang ="en ">
3+ < head >
4+ < meta charset ="utf-8 ">
5+ < link rel ="stylesheet " href ="contactcss.css ">
6+ < script type ="text/javascript " src ="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js "> </ script >
7+ < script type ="text/javascript ">
8+ $ ( document ) . ready ( function ( ) {
9+ $ ( ".btn" ) . click ( function ( ) {
10+ var firstname = $ ( "#firstname" ) . val ( ) ;
11+ var lastname = $ ( "#lastname" ) . val ( ) ;
12+ var description = $ ( "textarea" ) . val ( ) ;
13+ $ ( "#card" ) . append (
14+ "<div class='contactcard'><h2>" + firstname + " " + lastname + "</h2><p class='hide'>" + description + "</p><p class='here'>Click here for description</p></div>" )
15+ } )
16+ $ ( document ) . on ( "click" , ".here" , function ( ) {
17+ // var description = $("textarea").val();
18+ // $(this).parent().html("<p class='here'>" + description + "</p>");
19+ $ ( this ) . siblings ( "p" ) . toggle ( ) ;
20+ } )
21+ } )
22+ </ script >
23+ < title > </ title >
24+ </ head >
25+ < body >
26+ < div id ="container ">
27+ < div id ="info ">
28+ < form class ="names " action ="index.html " method ="post ">
29+ < div >
30+ < label for ="firstname "> First name:</ label >
31+ < input id ="firstname " type ="text " name ="firstname " value ="">
32+ </ div >
33+ < div >
34+ < label for ="lastname "> Last name:</ label >
35+ < input id ="lastname " type ="text " name ="lastname " value ="">
36+ </ div >
37+ < div class ="description ">
38+ < p > Description:</ p >
39+ < textarea name ="name " rows ="8 " cols ="50 "> </ textarea >
40+ </ div >
41+ < button class ="btn " type ="button " name ="button "> Add User</ button >
42+ </ form >
43+ </ div >
44+ < div id ="card ">
45+
46+ </ div >
47+ </ div >
48+ </ body >
49+ </ html >
Original file line number Diff line number Diff line change 1+ * {
2+ margin : 0px ;
3+ padding : 0px ;
4+ }
5+ # container {
6+ width : 970px ;
7+ margin : 0px auto;
8+ }
9+ # info {
10+ width : 400px ;
11+ margin : 20px 10px ;
12+ display : inline-block;
13+ }
14+ label {
15+ margin : 10px 0px ;
16+ }
17+ input {
18+ margin : 10px 0px ;
19+ }
20+ .description {
21+ margin : 30px 0px ;
22+ }
23+ textarea {
24+ margin : 10px 0px ;
25+ }
26+ # card {
27+ width : 350px ;
28+ margin : 20px 10px ;
29+ display : inline-block;
30+ vertical-align : top;
31+ }
32+ .contactcard {
33+ width : 325px ;
34+ height : 150px ;
35+ margin : 5px auto;
36+ border : 1px solid black;
37+ text-align : center;
38+ }
39+ .contactcard h2 , p {
40+ margin : 5px ;
41+ }
42+ .here {
43+ font-size : 14pt ;
44+ }
45+ .hide {
46+ display : none;
47+ }
You can’t perform that action at this time.
0 commit comments