Web Development

Element Storage in MooTools

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?

[code]store()[/code] function is used to store the any type of value in element and [code]retrieve()[/code] 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: [code]retrieve()[/code] function will return [code]TRUE[/code] if value found and return [code]FALSE[/code] if value not found.

Basic Usage of the element storage in Mootools:

[cc lang=”javascript”]
// Store value in element

// Retrieve Value from Element

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


Leave a Reply

Your email address will not be published. Required fields are marked *