是否可以在Chrome中查看jQuery添加的数据 [英] Is it possible to view jQuery added data in Chrome
问题描述
在创建网站时,我经常使用jQuery的 .data()
函数将数据添加到元素中。
有可能在Chrome浏览器中查看所有与元素一起存储的数据?
因此,当我检查一个元素时,它会在Chrome本身显示数据。
$ b
如果不是,可以编写一个插件来'扩展'到Chrome 元素检查器
以显示数据吗?
打开检查器,进入控制台,输入
$('< some selector>')。data()
然后命中返回以评估 data()
方法并直接显示其返回值。
没有必要使用 console.log
,除非您在非交互式代码中调用它。
When creating websites I often use jQuery's .data()
function to add data to elements.
Is it possible to view all data which is stored with an element in Chrome?
So when I inspect an element it shows the data in Chrome itself.
If not would it be possible to write a plugin to 'extend' to Chrome element inspector
to also show to data?
Open the inspector, and into the console, type
$('<some selector>').data()
and then hit return to evaluate the data()
method and show its return value directly.
There's no need to use console.log
unless you're calling it within non-interactive code.
这篇关于是否可以在Chrome中查看jQuery添加的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!