Hot Posts

jQuery | Introduction

jQuery Introduction

jQuery is an open source JavaScript library that simplifies the interactions between an HTML/CSS document, or more precisely the Document Object Model (DOM), and JavaScript.

Elaborating the terms, jQuery simplifies HTML document traversing and manipulation, browser event handling, DOM animations, Ajax interactions, and cross-browser JavaScript development.

What is jQuery?

jQuery is a popular JavaScript library designed to simplify HTML DOM tree traversal and manipulation, as well as event handling, CSS animation, and Ajax. It is free, open-source software licensed under the MIT License.

Note:

The only library available today that meets the needs of both designer types and programmer types is jQuery.

JQuery is widely famous with its philosophy of “Write less, do greater.” This philosophy can be further elaborated as 3 standards: Finding some elements (via CSS selectors) and doing something with them (via jQuery techniques) i.E. Discover a fixed of elements in the DOM, after which do something with that set of factors. Chaining more than one jQuery techniques on a hard and fast of factors The use of the jQuery wrapper and implicit iteration

The usage of jQuery (JS) library on HTML web page

  • There are numerous methods to begin the usage of jQuery to your internet website online.
  • Use the Google-hosted/ Microsoft-hosted content shipping network (CDN) to include a version of jQuery.
  • Download very own model of jQuery from jQuery.Com and host it on very own server or nearby filesystem.

Observe: All jQuery strategies are interior a report-geared up occasion to prevent any jQuery code from walking earlier than the record is finished loading (is prepared).

Basic syntax for any jQuery function is:

$(selector).action() 
  • A $ sign is to define/access jQuery
  • A (selector) is to “query (or find)” HTML elements in html page
  • A jQuery action() is the action to be performed on the selected element(s)

Example:

 <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
        <script>
            $(document).ready(function() {
                $("h2").click(function() {
                    $(this).hover();
                });
            });
        </script>
       

Learning passion

Why jQuery?

To number the points in the given text, you can add numbers to each paragraph manually. Here is the text with each point numbered:

1. A number of the important thing factors which aid the solution for why to apply jQuery: It's far relatively famous, that's to mention it has a large network of customers and a healthy quantity of contributors who participate as developers and evangelists.

2. It normalizes the variations between net browsers so you don’t need to.

3. It is intentionally a light-weight footprint with a simple but clever plugin architecture.

4. Its repository of plugins is enormous and has seen steady increase for the reason that jQuery’s release.

5. Its API is completely documented, together with inline code examples, which in the international of JavaScript libraries is a luxurious. Heck, any documentation at all became a luxurious for years.

6. It is pleasant, that is to mention it presents helpful ways to keep away from conflicts with different JavaScript libraries.

Advantages:

  • Huge variety of plug-ins. JQuery permits developers to create plug-ins on pinnacle of the JavaScript library. Huge development network
  • It has a good and comprehensive documentation
  • It is lots greater easy to apply compared to standard javascript and different javascript libraries. JQuery we could customers increase Ajax templates easily, Ajax permits a sleeker interface wherein actions may be executed on pages without requiring the entire web page to be reloaded.
  • Being light weight and a powerful chaining capabilities makes jQuery extra strong.

Disadvantages:

  • While JQuery has an excellent library in terms of quantity, relying on how lots customization you require in your internet site, the functionality may be constrained for this reason the usage of raw javascript can be inevitable in a few cases.
  • The JQuery javascript file is needed to run JQuery commands, whilst the size of this record is noticeably small (25-100KB depending on the server), it's far still a pressure on the consumer pc and perhaps your net server as nicely in case you intend to host the JQuery script to your personal net server.

Conclusion

jQuery remains a useful tool for web developers, especially for those who need to ensure compatibility across different browsers or who want to simplify their codebase. While modern JavaScript standards have introduced many features that jQuery originally pioneered, the library's ease of use and robust community support make it a valuable addition to your web development toolkit.

Post a Comment

0 Comments