+ 1

Why to use/not use jQuery?

I have learned the basics (and maybe a little more) about JS. I would like to know, what pros and cons jQuery has in comparison to JavaScript, as I prefer vanilla JS now, but have thought of learning jQuery. So basically, what I ask for is which is more efficient, JS or jQuery, as the speed of writing isn't such important to me.

3rd Jan 2019, 1:13 PM
Joel Kronqvist
Joel Kronqvist - avatar
5 Antworten
+ 14
Javascript is a client side scripting language while jQuery is javascript library that makes it much easier to use JS on your website. jQuery makes tasks like html/dom manipulation,event handling ,effects and animations easier. With jQuery you have a lot of built-in methods.. This were the pros. Now talking about cons Vanilla JS is faster than jQuery . So it is basically a tradeoff between ease of coding and code efficiency.
3rd Jan 2019, 2:41 PM
Mitali
Mitali - avatar
3rd Jan 2019, 3:35 PM
Mitali
Mitali - avatar
+ 9
jQuery it is more comfortable
5th Jan 2019, 7:52 PM
София
София - avatar
+ 7
Javascript is a programming language whereas jQuery is a framework to help make writing in javascript easier. It's particularly useful for simply traversing the DOM in an HTML page.  jQuery in terms of speed is quite fastfor modern browsers on modern computers. So is pure JavaScript. Both run drastically slower on older browsers and machines. PureJavascript to access the DOM can befaster as you can cut the overhead thatjQuery has on this. https://stackoverflow.com/questions/20283098/what-is-the-difference-between-javascript-and-jquery http://www.lucemorker.com/blog/javascript-vs-jquery-quick-overview-and-comparison
3rd Jan 2019, 1:43 PM
Raj Chhatrala
Raj Chhatrala - avatar
0
OK, thank you Mitali and Raj Chhatrala. I knew already jQuery is a JS library, I just forgot to mention that. So, if I understood this right, jQuery has some additional functions (related to animating the DOM, possibly?) and makes it easier to select and edit HTML elements, but JS is a little more effective, if used right. Did I get it?
3rd Jan 2019, 3:28 PM
Joel Kronqvist
Joel Kronqvist - avatar