It is most commonly used for appealing UI (like moving objects, flashy elements in the screen), user interactions (client-side validation, showing pop-up etc.) and for controlling the document content displayed to the user.
All variables are dynamic in type and existence. You declare a variable as,
var msg = "Hello World!";
You can create new functions or replace existing functions at runtime.
New codes are added to the browser when more script files are loaded and you can add any number of files at any time.
To start using jQuery on your page, you need to include one line of code in the header of your page like,
<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.2.1.min.js"></script >
You can also include the jQuery library as a local resource from your project folder.
But there are benefits using the CDN. If you use the minified version of the library, you will get the advantage of concurrent connections and multiple servers.
Lines of code
We can consider a simpler example,
Suppose I want to select all elements having class- simple-li,
On the other hand, if I use jQuery,
In my view, it is not right to compare the two or you cannot say one is better than the other. We need to use whichever is better suited to our requirement.
A few points to remember
jQuery is well suited for most applications, especially ones which need rapid development. jQuery takes care of the common browser errors by ironing the fixes right into the library. jQuery also takes care of browser compatibility issue which is a developer’s nightmare during deployment.
Thank you for reading!