Skip to content
raid-ox edited this page Sep 13, 2010 · 3 revisions

Method for manipulating item data

Syntax

$(element).items({arguments})

Routines

This method will execute different routines depending on the arguments passed.

item()

If no argument is passed, it will return the data held in item.
This only works if item and chain is active. Otherwise it will return false.

$('#element').item();

item(object)

If you pass an object to item, it will alter/extend the item data within the object.


$('#element').item({name:'Rizqi', country:'Germany'}); $('#element').item({country:'Indonesia'}); // Returns {name:'Rizqi', country:'Indonesia'} $('#element').item();

item('replace', object)

Replace item with object.

$('#element').item('replace', {name:'Solid Snake'});

item('remove')

Remove item from items.

item('root', root)

Root is the parent element, when item is part of items. if root is defined, it will set a new root.
Otherwise it returns its current root.

// Get current root
$('#element').item('root');
// Set new root
$('#element').item('root', $('#contacts'));

item('active')

Returns its status. true if active.

Clone this wiki locally