1. Difference between JavaScript and jQuery
S.No JavaScript jQuery
1 Meaning: Meaning:
JavaScript is the most popular JQuery is a fast and concise JavaScript
scripting language on the internet, Library that simplifies HTML document
and works in all major browsers, traversing, event handling, animating, and
such as Internet Explorer, Firefox, Ajax interactions for rapid web
Chrome, Opera, and Safari. development.
2 Composed of: Composed of:
JavaScript is a combination of ECMA jQuery has Document Object Model
Script and Document Object Model (DOM).
(DOM).
3 Web-based application creation: Web-based application creation:
JavaScript has many processes in Creating a web based application using
creating web based applications. jQuery becomes easier.
Example-1: Example-1: <a href=”test.html”
<a href=”test.html” onclick=”alert(‘this class=”css-class”>Test</a>
is the on-click event’);”>Test</a> $(“a.css-class”).click(function(){ alert(‘this
is the on-click event’); });
Example-2:
Two JavaScript function to change Example-2:
the background color with the onload One JQuery changing the background
function that would need to placed color of a body tag
into the body tag
$('body').css('background', '#ccc');
function changeBackground(color) {
document.body.style.background = This is the clean code JQuery provides.
color;
}
onload="changeBackground('red');"
Note:
If we use this unstructured code then
there is many problems to validate
the html source of web page. So
JQuery is best to use and easy to
understand.
4 Animation Creation: Animation Creation:
Animations are not possible using Animations can be easily created using
JavaScript. jQuery.
And, further updates on difference between questions and answers, please visit my blog @
http://onlydifferencefaqs.blogspot.in/