jQuery data() Method method is really useful for associating various objects, strings, arrays, etc with a DOM nodes and JavaScript objects . Basically jQuery holds the information you store/retrieve with data(name, value)/data(name) in an internal javascript object named cache . It can store arbitrary data associated with the matched elements or return the value at the named data store for the first element in the set of matched elements. When you use the data method , you need to pass two parameters - a key and a value to be stored. The key has to be a string, and the value can be any data structure, including functions, arrays and objects.

run this source code Try it Yourself

Full Source

 (C) 2023    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.
SiteMap  | Terms  | About