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 + " | ";
});
However, n
still returns [object Object]
:
EDIT: (Output) --
Name: click, Value: [object Object] |
--
Is there an efficient way to show everything inside that sucker, kind of like print_r
in PHP?
stringify() method is used to print the JavaScript object. JSON. stringify() Method: The JSON. stringify() method is used to allow to take a JavaScript object or Array and create a JSON string out of it.
Answer: Use console. log() or JSON. stringify() Method This method will print the object in browser console.
You can use .toSource()
to turn JavaScript objects into a string representation that you can view without a nice error console like in Firebug or Chrome Dev. Tools:
alert($(this).data("events").toSource());
Print content of object you can use
console.log(obj_str);
you can see the result in console like below.
Object {description: "test"}
For open console press F12 in chrome browser, you will found console tab in debug mode.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With