Element Storage in MooTools

  • Avinash
  • 0
  • Aug 19, 2011
  • Web Development

MooTools 1.2 has introduces the really interesting and useful feature which is element storage. With this feature we can store any type of variable on elements object without creating a new variable.

This is just like you store the information in variable and get it when you needs. But instead of variable you will store your information on HTML element without creating a new variable. isn’t this interesting?

store() function is used to store the any type of value in element and retrieve() function is used to retrieve the stored value.

You can store anything on an element like arrays, objects, numbers, strings, other elements, doesn’t matter.

Note: retrieve() function will return TRUE if value found and return FALSE if value not found.

Basic Usage of the element storage in Mootools:

// Store value in element $('id_of_element').store('key','value'); // Retrieve Value from Element $('id_of_element').retrieve('key');
// Store value in element

// Retrieve Value from Element

Here are some of my MooTools work where I have used the mootools element storage.

Related Posts

Written by Avinash

Avinash Zala is leading various projects which deals with the various technology involved with the web. A combination of perfect technical and management skills. Avinash would like to chat with you and convert your imagination into the working system. You can get in touch with him on Facebook and Twitter.

View all posts by: