Personally I do love using jQuery but I will have to say that he didn’t use the same logic/algorithm to just adding class if you follow my example you can see this could be done with pure js with two lines of code. //js var element = document.getElementById("myDIV"); element.classList.add("mystyle"); //jquery $("#myDIV").addClass("mystyle");
Wow, THANK YOU for presenting this so clearly. I was sporadically using jQuery without really understanding what any of the code meant (just copy / pasting code I would find to achieve what I needed to do, asking more experienced designers for help etc.). I knew I needed to step my game up from just html, css, and bootstrap so for the past 2 months have been teaching myself JavaScript. Long story short, recently someone tried to explain to me that what I have been learning (JavaScript) is "un-simplified" jQuery. I had no idea lol! But when they tried to explain how the two languages are tied together I was left confused. This really cleared up the basic correlation for me!
Jquery is a JS shortcut so this is why people always recommend learning JS vanilla because Jq is limited this was extremely helpful video im new to web development and just finished learning HTML CSS
I really like the way you present your information but I think your example is a little flawed. The same result could be achieved with just javascript with this one line: document.querySelector(".goodbye").classList.add("selected"); while the jQuery is shorter. It's not as drastic. I'm not sure if you were using that long-form example to emphasize your point more but I just wanted to point that out.
You're right! This video was first recorded in 2015 and predates the rising popularity of ES6. With that said, I think it still exemplifies the differences (it just might not technically be the best example to date). Thanks for watching!
Hey @daniel and @matt! Yeah good point, I definitely could have used querySelector. My thinking behind using getElementByClassName was.... When jQuery rose to popularity (around 2008-ish) querySelector wasn't supported across many of the browsers. To Matt's point, I thought getElementByClassName would emphasize the point to show a more stark contrast. I should have mentioned the updates to querySelector in the video though, that's a good point. Also, the fact that JS has caught up in recent years, and with more devs using ES6 etc also seems to be why less people are using jQuery these days. What do you think?
@@bedim4347does it affect memory because the variable is now needlesly outside the scope of the loop? With while loops we also declare the iterated variable outside, does that mean while loops are less eficient or am i mixing apples and oranges?
Actually, it won't work, b/c what is returned is an array. jQuery automatically iterates through the returned array. I think the problem people have with jQuery is due to a lot of people learning it do not actually know Javascript itself. They look at jQuery as if it is another language. That misconseption, however, does not rule out the fact that jQuery has successfully accomplished its purpose. It made DOM traversing and manipulation more convenient. If you do this long enough, you'll eventually find yourself still having to use non-jQuery code. And in regards to Vue, React, etc. Folks keep trying to replace jQuery.
jquery is basically just javascript. Its foundation is javascript but the stuff that you want to do has been created already for you. Just call the functions, procedures, etc. using just one line.
is there an advantage to using javascript instead of jquery? should I learn both? just one of them? i don't get it. It just seems like jquery is way simpler but jquery says it uses javascript language so i don't understand that.
I'd suggest you start learning JavaScript. Recently updates in the language have made it easier to learn, and more adaptable so that you can do more with it. Also, once you know JavaScript (the fundamentals) then you can always go learn jQuery. Really there's no harm in learning both. There's also no "right way" to learn. And anything you learn in one will likely influence or help you learn the other - it's all related. Hope that helps! TLDR; just start with one!
jQuery was made from JavaScript. It's like using a calculator when multiplying 2x2 digit numbers and that's jQuery instead of using pen and paper to multiply the numbers manually and that's JavaScript.
why making JavaScript look difficult. Come on bro!!?? document.getElementByClassName("goodbye").style. color="blue"; //Very simple Why all the variables
I prefer javascript because it's more readable and language-friendly. Sure, jquery is shorter but it's not as intuitive. And with snippets, writing javscript can still be pretty fast.
Thank you a lot. I'm learning code from a free website which is working great but i never understood how these two terms differentiate. Now, everything is cleared up!
When we begin to learn a new language and arrive at functions, the first thing we learn about them is that functions are there so that we don't have to retype the same code again and again everytime we want to use the sequence of code. So thank you, captain Obvious, for stating that jQuery is exactly that.
Best explanation on this subject on youtube so far!!! Thanks!
Personally I do love using jQuery but I will have to say that he didn’t use the same logic/algorithm to just adding class if you follow my example you can see this could be done with pure js with two lines of code.
//js
var element = document.getElementById("myDIV");
element.classList.add("mystyle");
//jquery
$("#myDIV").addClass("mystyle");
you are right! and even less: document.getElementById("myDIV").classList.add("mystyle");
I think for loop is needed to catch error & prevent crash.
Wow, THANK YOU for presenting this so clearly. I was sporadically using jQuery without really understanding what any of the code meant (just copy / pasting code I would find to achieve what I needed to do, asking more experienced designers for help etc.). I knew I needed to step my game up from just html, css, and bootstrap so for the past 2 months have been teaching myself JavaScript. Long story short, recently someone tried to explain to me that what I have been learning (JavaScript) is "un-simplified" jQuery. I had no idea lol! But when they tried to explain how the two languages are tied together I was left confused. This really cleared up the basic correlation for me!
That makes my day! Thanks for sharing James!
Jquery is a JS shortcut so this is why people always recommend learning JS vanilla because Jq is limited this was extremely helpful video im new to web development and just finished learning HTML CSS
I really like the way you present your information but I think your example is a little flawed. The same result could be achieved with just javascript with this one line:
document.querySelector(".goodbye").classList.add("selected");
while the jQuery is shorter. It's not as drastic. I'm not sure if you were using that long-form example to emphasize your point more but I just wanted to point that out.
You're right! This video was first recorded in 2015 and predates the rising popularity of ES6. With that said, I think it still exemplifies the differences (it just might not technically be the best example to date). Thanks for watching!
Ah! I see! I just saw the publish date and decided to be a keener :p Thanks for the quick response! You've made a new subscriber! :)
Thanks!!
Noticed the same thing right away. hahaha
Hey @daniel and @matt! Yeah good point, I definitely could have used querySelector.
My thinking behind using getElementByClassName was....
When jQuery rose to popularity (around 2008-ish) querySelector wasn't supported across many of the browsers. To Matt's point, I thought getElementByClassName would emphasize the point to show a more stark contrast. I should have mentioned the updates to querySelector in the video though, that's a good point.
Also, the fact that JS has caught up in recent years, and with more devs using ES6 etc also seems to be why less people are using jQuery these days. What do you think?
Favorite part is on line 29 where you declare the variable outside the loop
rip memory
@@bedim4347does it affect memory because the variable is now needlesly outside the scope of the loop? With while loops we also declare the iterated variable outside, does that mean while loops are less eficient or am i mixing apples and oranges?
What about the following line instead of five lines JS:
document.getElementsByClassName("goodbye")[0].className = "selected";
would also work
KK Except you don’t need [ 0 ].
Actually, it won't work, b/c what is returned is an array.
jQuery automatically iterates through the returned array.
I think the problem people have with jQuery is due to a lot of people learning it do not actually know Javascript itself.
They look at jQuery as if it is another language. That misconseption, however, does not rule out the fact that jQuery has successfully accomplished its purpose.
It made DOM traversing and manipulation more convenient.
If you do this long enough, you'll eventually find yourself still having to use non-jQuery code.
And in regards to Vue, React, etc. Folks keep trying to replace jQuery.
@@ozone1979 JavaScript remains the best
Clear and direct! Great explanation 👍
Nowadays, querySelectorAll puts it in a NodeList, but you still have to use forEach function to classList.add() on each of them.
My Bro You have experienced that how to visualize things, A salute to your from my side ,,
the most precise video for jquery, thank u ^_^
Essential different between jQuery and js: With jQuery we can do allot with one line.
Does this mean I should skip Javascript and just go straight to learning jQuery, then?
no
No for sure!!!, vanilla Javascript better for long term
Thank you for the info zorro and w.interested.wwiw
jQuery was made from JavaScript. If you open jQuery you can see complex javascript.
This is such a fantastic explanation. Thank you so much
So where should i begin after HTML and CSS? is it Javascript or jQuery?
Damn....this is the best explanation available....Thanks
Amazing presentation. Crystal clear. Thanks !! :))
Is it better to separate the languages?
jquery is basically just javascript. Its foundation is javascript but the stuff that you want to do has been created already for you. Just call the functions, procedures, etc. using just one line.
is there an advantage to using javascript instead of jquery? should I learn both? just one of them? i don't get it. It just seems like jquery is way simpler but jquery says it uses javascript language so i don't understand that.
I'd suggest you start learning JavaScript. Recently updates in the language have made it easier to learn, and more adaptable so that you can do more with it. Also, once you know JavaScript (the fundamentals) then you can always go learn jQuery.
Really there's no harm in learning both. There's also no "right way" to learn. And anything you learn in one will likely influence or help you learn the other - it's all related. Hope that helps! TLDR; just start with one!
can you do the EXACT same thing with Jquery or learning java script is preferable? how about for the more elaborate stuff? I am new to coding?
jQuery was made from JavaScript. It's like using a calculator when multiplying 2x2 digit numbers and that's jQuery instead of using pen and paper to multiply the numbers manually and that's JavaScript.
why making JavaScript look difficult.
Come on bro!!??
document.getElementByClassName("goodbye").style. color="blue";
//Very simple
Why all the variables
That will only get one class, you need the loop to set the color blue to every single one of those objects.
Thank you so much. Understood the concept now. Subscribed your channel
From Saudi Arabia big thanks for you
Thanks for your example i can undrarstened
Thank you i got some knowledge regarding jquery
I prefer javascript because it's more readable and language-friendly. Sure, jquery is shorter but it's not as intuitive. And with snippets, writing javscript can still be pretty fast.
super explanation. thanks bro. if possible can you please make video on jquery vs react vs vue
amazing explanation. Thank you!
No Need a for loop
Nice, greeting from Mexico
Good job
This video helped a lot thanks!
jQuery is still a JavaScript. It's a library of complex JS just like a shortcut. Without JS there will be no jQuery.
thank you so much
Great expansion
Thank you a lot. I'm learning code from a free website which is working great but i never understood how these two terms differentiate. Now, everything is cleared up!
nice explanation , thanx
Thank you
you exaggerate a lot in the difference between the two
You mean the mother vs the son
Fuckin awesome thanx!
gud one
This video is from 3 years ago makes this even more disappointing.
You can add a class to JavaScript waaaaaaaaaaaaaaaaaaaay easier than what you shiwed.. not very useful, thank you very much (ironic)
How would you do it? It'd be helpful to hear varying opinions and not only my own. I think that'll help everyone learn better if you can share.
When we begin to learn a new language and arrive at functions, the first thing we learn about them is that functions are there so that we don't have to retype the same code again and again everytime we want to use the sequence of code. So thank you, captain Obvious, for stating that jQuery is exactly that.