Plugins

The plugins site is currently in development.

We've been looking to provide a higher-quality, spam-free experience at the plugins site for some time, and a major error on our part forced us to shut down the current site before we could put the new one in place. We are developing a new site, and you can follow along with its development on GitHub. For more information about this transition, including steps you can take as a plugin author to prepare, please read our post about what's going on.

ID


ID Setter/Getter

A small plugin that will get the id of an element or set the id. It is not really useful except to save a few keystrokes from typing attr('id') or attr('id', 'value'). Its also slightly faster as well.

This will only apply the id to the first element or get the id of the first element in a set of matched elements.

To use:

$('.elem').id();  //Returns the id of the element with class .elem

$('.elem').id('newid'); // Sets the id of the element with class .elem to 'newid'

SnakeCharmer Selection Plugin

About SnakeCharmer

SnakeCharmer is a small and simple plugin for jQuery. It helps you to make logical connected selections of HTML elements. Think of a bunch of options (maybe generated out of some datasets) from which a range of multiple ones (or even a single one) can be selected. A typical example would be a calendar where the user should select some days for his summer leave days. Or, you have a seat plan where a client should select the seats he want to reserve for the weekly sneak peak in the local cinema. Beside that, with SnakeCharmer you easily can restrict the available seats according to the latest booking stand by specifying the initial jQuery selector string to not include elements that use a certain class name (which in turn may be used to visually format already reserved seats). Pragmatic, isn't it? :-)

jID: Quick Get & Set for the ID Property

This plugin is short and sweet. It allows you to shortcut the .attr('id',value) method by using .id() to get the value of the ID property, or using .id(value) to set the value of an element.

Let's take this div for example:

<div id='div1' class='example'>Hello!</div>

Setting

Now, let's set its ID to something else.

$('#div1').id('somethingelse');

Getting

Obviously, this is kinda counter productive:

$('#div1').id()

Why would we want to return the ID of a div what we already know the ID of? We don't. But, it can be useful in other areas:

//return the ID's of all the DIV tags with a class of 'example'
$('.example').each(function(){
    alert($(this).id())
})

Like I said! Just a simple shortcut. Feel free to expand on it.