Optimize Selectors

Selector optimization is less important than it used to be, as more browsers implement document.querySelectorAll() and the burden of selection shifts from jQuery to the browser. However, there are still some tips to keep in mind when selector performance becomes a bottleneck. link jQuery ExtensionsWhen possible, avoid selectors that include jQuery extensions. These extensions cannot … Continue reading

Advanced Plugin Concepts

link Provide Public Access to Default Plugin SettingsAn improvement we can, and should, make to the code above is to expose the default plugin settings. This is important because it makes it very easy for plugin users to override/customize the plugin with minimal code. And this is where we begin to take advantage of the … Continue reading

How to Create a Basic Plugin

Sometimes you want to make a piece of functionality available throughout your code. For example, perhaps you want a single method you can call on a jQuery selection that performs a series of operations on the selection. In this case, you may want to write a plugin. link How jQuery Works 101: jQuery Object MethodsBefore … Continue reading

Finding & Evaluating Plugins

One of the most celebrated aspects of jQuery is its extensive plugin ecosystem. From table sorting to form validation to autocompletion – if there’s a need for it, chances are good that someone has written a plugin for it. The quality of jQuery plugins varies widely. Many plugins are extensively tested and well-maintained, but others … Continue reading

Avoiding Conflicts with Other Libraries

The jQuery library and virtually all of its plugins are contained within the jQuery namespace. As a general rule, global objects are stored inside the jQuery namespace as well, so you shouldn’t get a clash between jQuery and any other library (like prototype.js, MooTools, or YUI). That said, there is one caveat: by default, jQuery … Continue reading

Data Methods

There’s often data about an element you want to store with the element. In plain JavaScript, you might do this by adding a property to the DOM element, but you’d have to deal with memory leaks in some browsers. jQuery offers a straightforward way to store data related to an element, and it manages the … Continue reading

Using jQuery UI with AMD

**Note:** This documentation refers to functionality made available in jQuery UI 1.11. As of jQuery UI 1.11, all of the library’s source files support using AMD. This means that you can manage your jQuery UI dependencies without using Download Builder, and load jQuery UI’s source files asynchronously using an AMD loader such as RequireJS. In … Continue reading

Using jQuery UI with Bower

**Note:** This documentation refers to functionality made available in jQuery UI 1.11. Bower is a package manager for the Web. You can use Bower to download libraries like jQuery UI from the command line, without having to manually download each project from their respective sites. As an example, suppose we’re starting a new project and … Continue reading

Using the classes Option

As of the 1.12 release, the jQuery UI widget factory includes a means of managing CSS class names through the classes option. This article will give you an overview of how the classes option works, and discuss what you can do with it. link Syntax overviewThe classes option is used to map structural class names … Continue reading

How To Use the Widget Factory

While most existing jQuery plugins are stateless – that is, we call them on an element and that is the extent of our interaction with the plugin – there’s a large set of functionality that doesn’t fit into the basic plugin pattern. In order to fill this gap, jQuery UI has implemented a more advanced … Continue reading