what is the meaning of these jquery random attributes in html and how jquery use them
any ideas please ??
This is the jQuery expando attribute, it's a bit random because it's generated on page load, it's "jQuery" + (new Date()).getTime()
(to avoid possible naming conflicts) but you'll notice the attribute is the same for all elements.
This is they key in $.cache
for the element's events and data...it's stored this way for a few reasons, the main is to avoid circular references. The ID is actually $.uuid
which is just an incrementing counter used for each element's key in $.cache
.
You can get the current attribute in jQuery 1.4+ with a simple alert($.expando)
, for an example of how it's used, say you wanted the data for that #wmd-preview
element, doing this:
$("#wmd-preview").data()
Is doing this:
$.cache[$("#wmd-preview")[0][$.expando]]
Also note that jQuery intentionally strips these out when you call .html()
to get the content.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With