<div id="a"></div>
<script src="jquery1.7.js"></script>
<script>

$('#a').data({name : 'sdf'});
var a = document.getElementById('a');
$.data(a);
console.log($.cache)

var obj = {};
$.data(obj, 'name', 'sunhaixun')
console.log(obj);

console.log($.cache[a[$.expando]]);

 

</script>

 

 

打印数据

jquery cache data

 

jquery.data 将数据 存储在$.cache 对象中 存贮中将elem[$.expando] = id = ++$.uuid;关联起来,取出的时候

id = elem[$.expando] ; $.cache[id] 就取出值

 

 

转载于:https://www.cnblogs.com/shxydx/articles/2688920.html

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-10
  • 2022-01-02
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-10-28
  • 2021-05-31
  • 2021-11-10
  • 2022-12-23
  • 2022-01-22
相关资源
相似解决方案