text stringlengths 1 81 | start float64 0 10.1k | duration float64 0 24.9 |
|---|---|---|
common JavaScript code that's in use by | 2,326.68 | 5.04 |
multiple different HTML pages multiple | 2,329.2 | 4.68 |
HTML pages can all include the same | 2,331.72 | 4.23 |
JavaScript source rather than needing to | 2,333.88 | 2.76 |
repeat myself | 2,335.95 | 2.669 |
use the same JavaScript across multiple | 2,336.64 | 4.02 |
different pages I can just use the same | 2,338.619 | 3.841 |
JavaScript across all of them and | 2,340.66 | 3.78 |
that'll be helpful too as we begin to | 2,342.46 | 3.45 |
take a look later at some JavaScript | 2,344.44 | 3.27 |
libraries which are JavaScript written | 2,345.91 | 4.05 |
by other people we can just include | 2,347.71 | 4.109 |
other people's JavaScript in our own | 2,349.96 | 4.349 |
webpages just by adding a script tag at | 2,351.819 | 4.23 |
the top of our page that specifies a | 2,354.309 | 3.181 |
particular source you may have already | 2,356.049 | 3.601 |
interacted with bootstrap that has its | 2,357.49 | 4.17 |
own JavaScript code and you can include | 2,359.65 | 4.139 |
bootstraps JavaScript just by including | 2,361.66 | 4.86 |
a script tag at the top of our HTML page | 2,363.789 | 5.131 |
in order to say go ahead and include all | 2,366.52 | 6.23 |
of that javascript in our page as well | 2,368.92 | 6.51 |
so what else can we do now now that we | 2,372.75 | 4.539 |
have the ability to like get at elements | 2,375.43 | 3.84 |
of the Dom and actually manipulate their | 2,377.289 | 4.141 |
contents well one thing we can do is | 2,379.27 | 4.47 |
begin to make our pages a little bit | 2,381.43 | 3.929 |
more interactive actually respond to | 2,383.74 | 4.049 |
what users are doing on the page whether | 2,385.359 | 4.68 |
the user is typing something in or maybe | 2,387.789 | 4.381 |
filling out a form for example so let's | 2,390.039 | 3.721 |
go ahead and try an example of that | 2,392.17 | 3.09 |
where the user might be filling out a | 2,393.76 | 3.51 |
form and we would like for our code to | 2,395.26 | 4.109 |
somehow respond to what it is that they | 2,397.27 | 4.11 |
type I'll go ahead and go back into | 2,399.369 | 6.42 |
hello dot HTML and now inside of the | 2,401.38 | 6.479 |
body of the page I've said hello at the | 2,405.789 | 3.99 |
top I'm here instead of a button I'm | 2,407.859 | 5.46 |
going to have a form this HTML form will | 2,409.779 | 4.83 |
look like the HTML forms we've seen | 2,413.319 | 3.871 |
before a have an input field that'll add | 2,414.609 | 4.531 |
the auto focus attribute to to mean like | 2,417.19 | 3.24 |
automatically focus this input field | 2,419.14 | 3.179 |
when I open the page because I might | 2,420.43 | 2.189 |
want | 2,422.319 | 2.911 |
user to start typing right away I'm | 2,422.619 | 4.67 |
gonna give this input field an ID of | 2,425.23 | 5.789 |
name for example and then a placeholder | 2,427.289 | 9.641 |
of name capital n whose type is text so | 2,431.019 | 7.201 |
what have I done here I've created an | 2,436.93 | 2.76 |
input field where the user can type in | 2,438.22 | 3.51 |
some text the placeholder the thing the | 2,439.69 | 4.02 |
user see is filled into that input field | 2,441.73 | 4.26 |
originally will just be capital and name | 2,443.71 | 3.69 |
telling them they should type their name | 2,445.99 | 3.869 |
in here and I've given this input field | 2,447.4 | 6.09 |
an ID some unique identifier such that I | 2,449.859 | 6.361 |
later on can reference and find this | 2,453.49 | 5.67 |
particular input field and then I have | 2,456.22 | 5.97 |
input type equals submit some way for me | 2,459.16 | 7.439 |
to now submit this form as well and so | 2,462.19 | 7.579 |
if I load this page load hello dot HTML | 2,466.599 | 6.27 |
here's what I see hello a field where I | 2,469.769 | 4.75 |
can type in my name the placeholder name | 2,472.869 | 3.301 |
shows up there for me and then a button | 2,474.519 | 5.52 |
where I can submit this form and now | 2,476.17 | 5.55 |
what I'd like to do inside of my | 2,480.039 | 3.75 |
JavaScript is instead of this hello | 2,481.72 | 3.779 |
function what I'm going to do is I'm | 2,483.789 | 4.23 |
going to first run some JavaScript when | 2,485.499 | 4.171 |
the Dom is done loading and so I'll use | 2,488.019 | 2.941 |
that same line from before you're gonna | 2,489.67 | 2.97 |
see it quite a bit we're gonna say | 2,490.96 | 4.529 |
document add event listener Dom content | 2,492.64 | 5.669 |
loaded and then this function to mean go | 2,495.489 | 4.86 |
ahead and run this code when the Dom is | 2,498.309 | 4.171 |
done loaded and the code I'd like to run | 2,500.349 | 6.69 |
is to say when I submit the form I want | 2,502.48 | 6.089 |
something to happen when I submit the | 2,507.039 | 3.06 |
form maybe I want to display an alert | 2,508.569 | 3.601 |
that if I type in Brian it'll say hello | 2,510.099 | 3.541 |
Brian or if I typed in David it'll say | 2,512.17 | 3.72 |
hello David for example so how many I do | 2,513.64 | 4.74 |
that well how do I get the form that's | 2,515.89 | 3.99 |
the first question anytime you want to | 2,518.38 | 3.659 |
get at an element one particular element | 2,519.88 | 4.619 |
on an HTML page usually what we're going | 2,522.039 | 5.641 |
to do is document dot query selector to | 2,524.499 | 5.55 |
say get me the element that is a form | 2,527.68 | 3.99 |
and there's only one form on the page so | 2,530.049 | 3.06 |
I don't have to worry about ambiguity | 2,531.67 | 3.56 |
I'm just saying get me that form and | 2,533.109 | 6.24 |
then I can say dot on submit when you | 2,535.23 | 6.849 |
submit the form what code should run and | 2,539.349 | 4.561 |
if I had a name of a function like a | 2,542.079 | 4.051 |
function f I could just say like run | 2,543.91 | 4.369 |
function f when the form is submitted | 2,546.13 | 5.28 |
but alternatively just as before instead | 2,548.279 | 4.631 |
of providing the name of a function I | 2,551.41 | 3.57 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.