显示对象内容 - JS / jQuery [英] Display object contents - JS/jQuery
本文介绍了显示对象内容 - JS / jQuery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用 $(this).data(events);
返回 [object Object]
,我需要看看那里到底发生了什么。我发现了这个:
With $(this).data("events");
returning [object Object]
, I need to see what's actually going on in there. I found this:
var Finder = "";
$.each($(this).data("events"), function(i, n){
Finder += "Name: " + i + ", Value: " + n + " | ";
});
但是, n
仍然会返回 [object Object]
:
(输出) -
Name: click, Value: [object Object] |
-
是否有效率在PHP中显示所有内容的方式,有点像 print_r
?
Is there an efficient way to show everything inside that sucker, kind of like print_r
in PHP?
推荐答案
Chrome(或其他浏览器)中的
console.log($(this).data(events))
将允许您钻取对象。
console.log($(this).data("events"))
in Chrome (or other browsers) would allow you to drill into the object.
Ctrl + Shift + J让你进入Chrome的控制台。
Ctrl+Shift+J gets you to the console in Chrome.
这篇关于显示对象内容 - JS / jQuery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文