-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathjquery_examples.js
More file actions
41 lines (23 loc) · 1.29 KB
/
jquery_examples.js
File metadata and controls
41 lines (23 loc) · 1.29 KB
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
/**
* jQuery examples
*/
var form = document.getElementById('my-form');
form.classList.add('someClass');
form.classList.remove('someClass');
// 1. Create the document on load function - long & short
// 2. Get all list elements <li class="list-item"></li> and add class list-item-big
// 3. Demonstrate the .map() function from jQuery - Get all data-total and sum them together
// 4. Change the attribute of <input type="text" /> from type text --> password
// 5. Add a padding to the body 40px
// 6. Change the value of the username and password to myUserName & Sn3akY.P4ssw0rd!
// 7. Fill out the form and serialize it
// 8. Demonstrate how this could be useful when posting to a server using $.post()
// 9. Use the empty() function on <div class="sub-container"></div>
// 10. Register a submit handler on <form id="my-form"></form>
// 11. Use preventDefault() on the event or return false
// 12. Trigger the form with jQuery with extra params [1, 2]
// 13. Demonstrate fadeIn() / fadeOut()
// 14. Demonstrate show() / hide()
// 15. Demonstrate slideUp() / slideDown()
// 16. Demonstrate an animation of #pizza which sets the opacity: 0, marginLeft: 1000 and height: 0 for 4s
// 17. Extend the jQuery library with two new functions, one which returns the nextSibling and other which returns the firstChild