jQuery的.数据在萤火虫不可见? [英] jquery .data not visible in firebug?

查看:69
本文介绍了jQuery的.数据在萤火虫不可见?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以使用jquery .data属性,并通过警报确认它是否有效,但是在使用Firebug的页面中看不到数据属性.

I can use the jquery .data attribute and an alert confirms that it worked, but I don't see data attribute in page using firebug.

$('#something').data('foo', 52);        
alert($('#something').data('foo'));     

推荐答案

.data(...)中的信息不是可见的DOM属性.

The information put into .data(...) is not a visible DOM attribute.

您可以通过执行console.log($('#something').data());

演示: http://jsfiddle.net/maniator/pQybU/

这篇关于jQuery的.数据在萤火虫不可见?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆