Jon Hobbs-Smith wrote an excellent roundup of 25 good coding habits when usingÂ jquery.
I was particularly interested to read tip#14:
14. Even better, use jQuery’s internal data() method to store state
It’s not very well documented for some reason but jQuery has an internal data() method which can be used to store information in key/value pairs against any DOM element. Storing a piece of data is as simple as this…$('#myDiv').data('currentState', 'off');
Argl, i wish i had known that earlier… Still, amazing little feature.