text
stringlengths
1
81
start
float64
0
10.1k
duration
float64
0
24.9
property of an HTML element called it's
3,483.48
5.04
a data set property and then I can say
3,485.97
4.8
something like button data set
3,488.52
4.95
color to get at the data - color
3,490.77
5.85
attribute so a lot of stuff going on
3,493.47
4.29
here let's go ahead and try and read
3,496.62
2.79
through this entire thing and just get a
3,497.76
2.88
feel for what's happening because we
3,499.41
2.91
have functions nested within other
3,500.64
3.42
functions nested within other functions
3,502.32
4.56
up at the very top I said add an event
3,504.06
4.77
listener to the document when the
3,506.88
3.99
documents Dom content is loaded meaning
3,508.83
3.6
all of the content of the page is done
3,510.87
3.96
loading go ahead and run this function
3,512.43
5.4
this is the body of the function so what
3,514.83
4.32
do I want to do when the page is done
3,517.83
3.48
loading I'm going to document dot query
3,519.15
4.65
selector all looking for all of the
3,521.31
4.74
buttons and if I wanted to if there
3,523.8
3.81
could be more buttons I could have added
3,526.05
3.24
a class to these buttons and just look
3,527.61
3.36
for things of the particular class query
3,529.29
3.3
selector all just returns all of the
3,530.97
3.48
elements that match a particular query
3,532.59
5.4
and then I'm saying for each of those
3,534.45
5.13
buttons for each of the buttons that
3,537.99
3.93
came back I would like to run a function
3,539.58
4.5
on each of those buttons I'm basically
3,541.92
3.66
saying if I have three buttons that came
3,544.08
3.36
back let me run a function on the first
3,545.58
3.48
button then the same function on the
3,547.44
3.39
second button then the same function on
3,549.06
3.57
the third button and what is that
3,550.83
4.2
function well it's this function here a
3,552.63
5.16
function that takes as input the button
3,555.03
4.41
its first gonna pass in as input the
3,557.79
3.45
first button then the second button then
3,559.44
4.47
the third and what this function does is
3,561.24
5.55
it adds an onclick handler to the button
3,563.91
5.28
it says when the button is clicked on go
3,566.79
4.26
ahead and run this other function and
3,569.19
3.9
this function now is the function that
3,571.05
3.93
will run when the button is clicked on
3,573.09
4.38
to say when the button is clicked on get
3,574.98
5.84
me the hello element change its color to
3,577.47
6.99
button dataset color and button dataset
3,580.82
5.95
that color takes a button takes an HTML
3,584.46
4.68
element like this one here and accesses
3,586.77
4.47
its data set all of its data properties
3,589.14
5.37
and specifically accesses the color data
3,591.24
5.1
property which in this case is equal to
3,594.51
3.45
red and that is what we would like to
3,596.34
4.98
set color equal to so a little bit more
3,597.96
4.41
complexity we've seen before
3,601.32
3.81
but now we've been able to reduce what
3,602.37
5.16
was three different event handlers into
3,605.13
4.74
just a single one and now this is going
3,607.53
4.14
to work the same way change it to red
3,609.87
4.8
blue and green all by just using those
3,611.67
4.83
data properties that we have access to
3,614.67
3.96
and so when in doubt about how these
3,616.5
3.48
things are working about what query
3,618.63
3.09
selector is returning the JavaScript
3,619.98
3.21
console can be a very powerful tool for
3,621.72
2.79
this so you can go into the JavaScript
3,623.19
1.89
console
3,624.51
2.49
and actually manipulate things you can
3,625.08
4.02
running run queries you can run
3,627
3.78
functions you can even modify their
3,629.1
3.66
values of variables like if I go back
3,630.78
5.49
for instance to counter dot HTML or head
3,632.76
6.27
this counter that's counting 0 1 2 3 4
3,636.27
5.22
if I wanted to I could say something
3,639.03
6
like counter equals 27 just like change
3,641.49
5.85
the value of the counter nothing appears
3,645.03
3.96
to have changed on the page I didn't say
3,647.34
3.96
update anything on the page but now next
3,648.99
4.02
time I run count it's going to update
3,651.3
3.9
the value of the count to 28 because I
3,653.01
3.84
had updated the value inside of the
3,655.2
3.3
JavaScript console it's going to
3,656.85
3.66
increment that value display that value
3,658.5
4.53
inside of the h1 element so you can
3,660.51
4.26
modify variables that you can run
3,663.03
4.56
functions you can run document query
3,664.77
4.23
selector to figure out what particular
3,667.59
3.3
elements are going to come back all
3,669
3.27
through the use of the javascript
3,670.89
3.33
console which can be a very very
3,672.27
3.81
powerful tool especially as you begin
3,674.22
3.99
working on trying to debug these
3,676.08
4.32
programs and trying to figure out what
3,678.21
4.26
might be wrong with them it turns out
3,680.4
3.51
too that there are other changes that we
3,682.47
3.09
can make in order to optimize our code a
3,683.91
3.03
little bit more in order to make it a
3,685.56
3.33
little bit more succinct and one way is
3,686.94
3.18
that in more recent versions of
3,688.89
2.49
JavaScript they've introduced a
3,690.12
3.3