What is the difference between jQuery and JavaScript?

JavascriptjQueryWeb DevelopmentFront End Technology

The following is the difference between jQuery and JavaScript:

jQuery

jQuery is a fast and concise JavaScript library created by John Resig in 2006. jQuery simplifies HTML document traversing, event handling, animating, and Ajax interactions for Rapid Web Development.

JavaScript

JavaScript is a lightweight, interpreted programming language. It is designed for creating network-centric applications. It is complimentary to and integrated with Java. JavaScript is very easy to implement because it is integrated with HTML. It is open and cross-platform.

jQuery is automatically optimized to work with a lot of browsers. But, JavaScript is still dealing with some issues such as cross-browser compatibility. This can be due to poor JavaScript implementation practices by web browser developers.

jQuery needs less testing of code, and lesser code for the same goal, when compared with JavaScript. For example, to change font-size, background color, etc.

Let us see 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 also, which shows that jQuery minimizes the code and is easier to use.

raja
Published on 22-Dec-2017 16:51:18
Advertisements