Afrikaans
Akan
Albanian
Amharic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranรฎ)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
All right guys.
Now in this module I want to introduce you to the most popular Javascript library and it's of course
jQuery.
Now there's thousands of Javascript libraries out there, and in later modules we're going to be exploring
some of these libraries,
but none of these libraries have been used or downloaded as often as jQuery.
So why is that?
Well let's take a look at some code that we've written before.
So if we break this code down, essentially what it's doing is it's looking inside the entire document
and it's querying for all the elements that have the selector of button,
so all of the HTML button elements. And then we're going to add an event listener that is going to detect
for clicks on the button. And when it does get detected then we're going to run the callback function
to again look through the document and query for the selector of h1, and then we're going to change
the style, namely the color of that h1 to the color red, and we're using a for loop to traverse through
all of the buttons on our web page in order to add this event listener and this behavior to all of those
buttons.
So we wrote this code in our drumkit.
And this is pure Javascript and it's actually a little bit crazy, if you really think about it, in order
to do something relatively simple,
why does it require so many lines of code,
and who's going to take care of all our joint pain from all this typing?
Now you know how sometimes you have these thoughts and you moan and complain about it a little bit and
then you kind of get over yourself, right?
But not this guy.
This is John Resig, and he was really unhappy with the way that Javascript worked in web development.
He was really frustrated by how unnecessarily complex and lengthy the code had to be.
So whereas most of us probably had that thought and we promptly forgot about it,
not this guy. John decided that he was going to write a library that would do exactly the same as all
of this Javascript code,
but it was as short and as sweet as this.
And so jQuery was born.
It's a library,
so a bunch of code that somebody else wrote that you can incorporate into your own projects and use to
improve your own projects or to make your life simply a lot easier.
Now we've come across libraries before.
Previously we created web sites and we incorporated the Bootstrap library in order to be able to incorporate
code that somebody else wrote in the Bootstrap library to make our lives much easier and make it much
quicker to improve the user interface of our Web site.
Now what jQuery allows you to do is take a line of code, say this, where we're looking through the
DOM of our web site, we're selecting the document and we're querying for the selector h1.
So we're looking for the h1 element in our web page.
Now if we were to use the jQuery library, then we can get rid of all of that and simply say
jQuery("h1").
And if you want to be even shorter, the shorthand way to write jQuery is simply a dollar sign.
So $("h1") does exactly the same as document.querySelector
("h1").
And you can see that it's a lot lot shorter and that will make our Javascript code a lot easier to read,
a lot easier to debug and a lot faster to write,
so we don't have to end up breaking our fingers by typing so much Javascript code.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.