forked from cassandradanger/Porta-HTML-CSS-review
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjq-review-nots.js
33 lines (30 loc) · 1.13 KB
/
jq-review-nots.js
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
$(document).ready(onReady);
function onReady() {
console.log("hello");
// select pizzaPrices and remove it
$("#pizzaPrices").remove();
// DOM traversal - lets us navigate to other elements down or up the tree
// .addClass lets us manipulate the class...
// this is the preferred way of manipulating the DOM as opposed to applying CSS directly from JS (using .css)
$('ul').children().addClass('bold');
// selecting the h1 and using a getter to get the value
let val = $("#pizzeriaName").text();
console.log("this is the value of the h1: ", val)
// selecting the h1 and use a setter to set the value
$("#pizzeriaName").text(`Casie's NEW Pizza Place`);
// attaching an onClick event to the orderBtn
$("#orderBtn").on('click', function(){
handleClick()
});
$("header").on('click', '#clickMe', function(){
secondHandleClick()
});
}
function handleClick(){
console.log('button clicked!')
$("#orderBtn").toggleClass('updateOrderBtn');
$("header").append(`<button id="clickMe">does this work?</button>`)
}
function secondHandleClick(){
alert('WOWOWOWOWOWWWWWWW');
}