files
This commit is contained in:
14
javascript/8-more-jquery-basics/README.md
Normal file
14
javascript/8-more-jquery-basics/README.md
Normal file
@ -0,0 +1,14 @@
|
||||
### Intro to jQuery
|
||||
|
||||
In this assignment, you will be dynamically adding list elements with the comments from the form.
|
||||
|
||||
The flow is something like this - the user writes in the form and presses the submit button. That text is added to the page, under the form. The page is not refreshed, and the user can continue to add items.
|
||||
|
||||
Research the following to accomplish this challenge.
|
||||
|
||||
jQuery .append
|
||||
Form inputs and how to access their values
|
||||
jQuery .on (in this assignment, you will be using .on('submit'))
|
||||
preventDefault
|
||||
|
||||
|
5
javascript/8-more-jquery-basics/application.js
Normal file
5
javascript/8-more-jquery-basics/application.js
Normal file
@ -0,0 +1,5 @@
|
||||
(function($, window, document) {
|
||||
$(function(){
|
||||
//your code here
|
||||
});
|
||||
}(window.jQuery, window, document));
|
15
javascript/8-more-jquery-basics/index.html
Normal file
15
javascript/8-more-jquery-basics/index.html
Normal file
@ -0,0 +1,15 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" type="text/css" href="main.css">
|
||||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="application.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<form id="post-comment" action="#" method="post">
|
||||
<input type="text" name="comment" placeholder="Type your comment.">
|
||||
<input type="submit" value="Submit">
|
||||
</form>
|
||||
<ul id="comments"></ul>
|
||||
</body>
|
||||
</html>
|
19
javascript/8-more-jquery-basics/main.css
Normal file
19
javascript/8-more-jquery-basics/main.css
Normal file
@ -0,0 +1,19 @@
|
||||
body {
|
||||
margin: 0 auto;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
#post-comment {
|
||||
margin-top: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
li {
|
||||
list-style: none;
|
||||
height: 30px;
|
||||
width: 100%;
|
||||
padding: 1em;
|
||||
}
|
||||
|
||||
li:nth-child(odd) {
|
||||
background-color: lightgrey;
|
||||
}
|
Reference in New Issue
Block a user