Equivalent of `.data()` for jQuery objects
<p>I have a jQuery object <code>$myObject</code> that contains the elements <code>el_1, el_2, ..., el_n</code>. Doing</p>

<pre><code>$myObject.data('foo', 'bar');
</code></pre>

<p>will assign the value <code>'bar'</code> to the data property <code>foo</code> for each element <code>el_1, el_2, ..., el_n</code>. Instead, I would like to associate data to the jQuery object <code>$myObject</code> <em>as a single entity</em>.</p>

<p>I guess I could do</p>

<pre><code>$myObject['foo'] = 'bar';
</code></pre>

<p>but this may cause collisions with other properties and methods of the jQuery object. Is there a "jQuery-safe way" to associate data with a jQuery object?</p>
