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.
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!
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");
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.
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!
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:
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.
23 responses to “jQuery vs Javascript”
Why you r not talking about performance difference, are peoples are stupid replacing one line of jQuery with five lines of VanillaJS..
Nowadays, querySelectorAll puts it in a NodeList, but you still have to use forEach function to classList.add() on each of them.
Is it better to separate the languages?
What a pile of shit! document.querySelector(“.Goodbye”).className = “selected”;
Single line coding with Vanilla JS.
super explanation. thanks bro. if possible can you please make video on jquery vs react vs vue
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?
What about the following line instead of five lines JS:
document.getElementsByClassName("goodbye")[0].className = "selected";
would also work
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.
Good job
You mean the mother vs the son
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!
So where should i begin after HTML and CSS? is it Javascript or jQuery?
gud one
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");
Favorite part is on line 29 where you declare the variable outside the loop
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.
You can add a class to JavaScript waaaaaaaaaaaaaaaaaaaay easier than what you shiwed.. not very useful, thank you very much (ironic)
nice explanation , thanx
Maybe if you are using JavaScript from 2008. Why not use "classList.add('selected')"? I think you need to brush up on your JS my friend
Really useful! Amazing explanation! 🙂
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!
thank you so much
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.