- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Why do we use jQuery over JavaScript?
jQuery is a JavaScript library, so it operates on top of JavaScript. It cannot exist on its own, so you can't use one over the other. You can use just JavaScript or JavaScript and jQuery. jQuery was introduced to make development with JavaScript easier. It will reduce the development time. Use it to add animation and even handling on your website.
jQuery simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is easier to use compared to JavaScript and its other JavaScript libraries. You need to write fewer lines of code while using jQuery, in comparison with JavaScript.
Let us see the following code snippet as an example of jQuery and JavaScript to change the background color:
JavaScript
function changeColor(color) { document.body.style.background = color; } Onload=”changeColor('blue');”
jQuery
$ ('body') .css ('background', '#0000FF');
As shown above, both the code snippets are doing the same work of changing the background color. But jQuery takes less code and in this way you can work around other examples, which shows that jQuery minimizes the code and is easier to use.
- Related Articles
- Why do we use JSON.stringify() method in jQuery?
- Why do we use "use strict" in JavaScript?
- How do we use jQuery selector eq:()?
- Why do we use Convex Mirrors ?
- Where do we use $.extend() method in jQuery?
- How do we use # in jQuery Attribute Selector?
- How do we use .not() with jQuery selector?
- Why do we use random.seed() in Python?
- Why do we use interfaces in Java?
- Why do we use brackets in BODMAS?
- Why do we use pandas in python?
- Why do we use comma operator in C#?
- Why do we use internal keyword in C#?
- Why do we use modifiers in C/C++?
- Why do we use restrict qualifier in C++?
