Display object contents - JS/jQuery

前端 未结 4 606
走了就别回头了
走了就别回头了 2021-02-05 21:51

With $(this).data(\"events\"); returning [object Object], I need to see what\'s actually going on in there. I found this:

var Finder =         


        
相关标签:
4条回答
  • 2021-02-05 21:59

    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.

    0 讨论(0)
  • 2021-02-05 22:01

    If you can't use console.log then alert( $(this).data("events").toSource() ) can also be used.

    0 讨论(0)
  • 2021-02-05 22:08

    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());
    
    0 讨论(0)
  • 2021-02-05 22:11

    console.log($(this).data("events")) in Chrome (or other browsers) would allow you to drill into the object.

    Ctrl+Shift+J gets you to the console in Chrome.

    0 讨论(0)
提交回复
热议问题