是否可以在Chrome中查看jQuery添加的数据 [英] Is it possible to view jQuery added data in Chrome

查看:90
本文介绍了是否可以在Chrome中查看jQuery添加的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在创建网站时,我经常使用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屋!

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