-
Notifications
You must be signed in to change notification settings - Fork 4
Element::item
raid-ox edited this page Sep 13, 2010
·
3 revisions
Method for manipulating item data
$(element).items({arguments})
This method will execute different routines depending on the arguments passed.
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();
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();
Replace item with object.
$('#element').item('replace', {name:'Solid Snake'});
Remove item from items.
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'));
Returns its status. true if active.