This was the preparatory project learning how to manipulate the DOM with jQuery before implementing it into our HolbertonBnB project.
- tests: Folder of HTML files for testing DOM manipulation scripts.
-
0. No jQuery
- 0-script.js: JavaScript script that uses
document.querySelectorto update the text color of the HTML tagHEADERto red (#ff0).
- 0-script.js: JavaScript script that uses
-
1. With jQuery
- 1-script.js: JavaScript script that uses jQuery to update the
text color of the HTML tag
HEADERto red (#ff0).
- 1-script.js: JavaScript script that uses jQuery to update the
text color of the HTML tag
-
2. Click and turn red
- 2-script.js: JavaScript script that uses jQuery to update the text color
of the HTML tag
HEADERto red (#ff0) when the user clicks on the tagDIV#red_header.
- 2-script.js: JavaScript script that uses jQuery to update the text color
of the HTML tag
-
3. Add
.redclass- 3-script.js: JavaScript script that uses jQuery to add the class
.redto the HTML tagHEADERwhen the user clicks on the tagDIV#red_header.
- 3-script.js: JavaScript script that uses jQuery to add the class
-
4. Toggle classes
- 4-script.js: JavaScript script that uses jQuery to toggle the class
of the HTML tag
HEADERbetween.redand.greenwhen the user clicks on the tagDIV#red_header.
- 4-script.js: JavaScript script that uses jQuery to toggle the class
of the HTML tag
-
5. List of elements
- 5-script.js: JavaScript script that uses jQuery to add a
LIelement to a list when the user clicks on the tagDIV#add_item. - Adds the element
<li>Item</li>toUL.my_list.
- 5-script.js: JavaScript script that uses jQuery to add a
-
6. Change the text
- 6-script.js: JavaScript script that uses jQuery to update the text
of the HTML tag
HEADERto "New Header!!!" when the user clicks on the tagDIV#update_header.
- 6-script.js: JavaScript script that uses jQuery to update the text
of the HTML tag
-
7. Star wars character
- 7-script.js: JavaScript script that uses jQuery to fetch the Star
Wars API
https://swapi.co/api/people/5/?format=jsonand display the name in the HTML tagDIV#character.
- 7-script.js: JavaScript script that uses jQuery to fetch the Star
Wars API
-
8. Star Wars movies
- 8-script.js: JavaScript script that uses jQuery to fetch and list
all movie titles from the Star Wars API
https://swapi.co/api/films/?format=json. - Titles are listed in the HTML tag
UL#list_movies.
- 8-script.js: JavaScript script that uses jQuery to fetch and list
all movie titles from the Star Wars API
-
9. Say Hello!
- 9-script.js: JavaScript script that uses jQuery to fetch and display
how to say "Hello" in French using the API
https://fourtonfish.com/hellosalut/?lang=fr. - Displays the translation in the HTML tag
DIV#hello. - Works when imported in the
HEADtag.
- 9-script.js: JavaScript script that uses jQuery to fetch and display
how to say "Hello" in French using the API
-
10. No jQuery - document loaded
- 100-script.js: JavaScript script that uses
document.querySelectorto update the text color of the HTML tagHEADERto red (#ff0). - Works when imported in the
HEADtag.
- 100-script.js: JavaScript script that uses
-
11. List, add, remove
- 101-script.js: JavaScript script that uses jQuery to add, remove,
and clear
LIelements from a list based on user click input. - Adds a new element when the user clicks
DIV#add_item.- Adds
<li>Item</li>to the HTML tagUL.my_list.
- Adds
- Removes the last element when the user clicks
DIV#remove_item. - Clears all elements when the user clicks
DIV#clear_list. - Works when imported in the
HEADtag.
- 101-script.js: JavaScript script that uses jQuery to add, remove,
and clear
-
12. Say hello to everybody!
- 102-script.js: JavaScript script that uses jQuery to fetch and
display how to say "Hello" in a given language using the API
https://www.fourtonfish.com/hellosalut/hello/. - Fetches the translation for the language entered in the HTML tag
INPUT#language_code. - Fetches the translation when the user clicks on the HTML tag
INPUT#btn_translate. - Displays the translation in the HTML tag
DIV#hello. - Works when imported in the
HEADtag.
- 102-script.js: JavaScript script that uses jQuery to fetch and
display how to say "Hello" in a given language using the API
-
13. And press ENTER
- 103-script.js: JavaScript script that uses jQuery to fetch and
display how to say "Hello" in a given language using the API
https://www.fourtonfish.com/hellosalut/hello/. - Identical to 102-script.js except that the tranlsation is fetched
when either the user clicks on the HTML tag
INPUT#btn_translateor pressesENTERwhen hovering over the tagINPUT#language_code.
- 103-script.js: JavaScript script that uses jQuery to fetch and
display how to say "Hello" in a given language using the API