Catching up with JQuery: Now used in over 30% of Websites
The jQuery API is intended to be straightforward and intuitive. The API includes functionality for:
- Traversing over the DOM
- Manipulating DOM elements
- CSS handling
- Event handling
- Ajax interactions
- Utility Functions
- A UI library
- An Effects library
The jQuery framework uses a simple selector as the means of getting and manipulating DOM elements. Once an element in the DOM is obtained, it becomes a jQuery object and any library methods can be invoked on it. The jQuery framework allows the use of complex selectors as well, i.e. elements based on parent-child relationships, attributes and filters.
The Traversing (or navigating through the DOM elements) API include methods for advanced filtering of already-selected collections of elements, with methods such as filter(), is(), not() and slice().
Other traversing API are used for finding specific elements based on their relationships to other elements (as opposed to using id or class selectors) is also made easy with methods like children(), find(), contents(), next(), prev(), parents() and siblings().
Once a DOM element is selected (either by selection or creation), the jQuery manipulation functionality is available. This includes:
- Inserting an element in the document
- Setting inner HTML or text, insert content at the start or end of other elements, before or after other elements or wrap around other elements
- Replace matched elements
- Remove elements
- Clone elements
The CSS component provides a set of tools for getting and setting CSS properties of any element or collection of elements. Other tools in this category include the width() and height() methods as well as an offset() method for obtaining the relative offset of any specified element.
The jQuery framework provides a cross-browser implementation of working with events. Methods are exposed for defining and firing custom events, as well as bindings to standard DOM events. The jQuery framework also offers a wide range of event helpers, which wrap standard DOM events in jQuery functionality. This functionality is intended to make the reaction to things like clicks on particular elements possible with minimal code and no need for browser detection.
The jQuery Ajax API include methods for loading remote pages, data and scripts using get or post requests, simple access to JSON data and a set of custom AJAX events as way to work with the success, complete, start, stop and error events.
Caitie McCaffrey Apr 24, 2015