You shouldn't use $.data directly, it's for the internals. You should be using data() on elements, like $('#someelement').data('name', 'Roger');
see here: http://docs.jquery.com/Core/data and here: http://docs.jquery.com/Internals On Jun 29, 4:41 am, Steven Yang <kenshin...@gmail.com> wrote: > Hi > Sorry if its already been asked > > when i used $.data and pass in ''(empty string), it return me 7. no matter > what i have put for ''. > when i looked at the code i believe 7 was just a generated id from jQuery. > and the reason why it always return the id is because of > // Return the named cache data, or the ID for the element > return name ? > jQuery.cache[ id ][ name ] : > id; > > because '' is false in this case. > > is this a bug? or is it an expected behavior? > > Thanks