5

I'm trying to alert() the properties of the javascript object. Since the text in alert isn't scrollable, I can see only part of it. How do I fix this? I'm using FF 3.5.

Eugene Yarmash
  • 142,882
  • 41
  • 325
  • 378

4 Answers4

10

Install Firebug and use console.log(myObj);

You can inspect the object properly in this way!

Community
  • 1
  • 1
David Snabel-Caunt
  • 57,804
  • 13
  • 114
  • 132
2

You can split the text into many pieces and alert many different times.
Or, you can make a textArea on the page and set the innerHTML of the textarea to your output message [what I do] Note that if you want to do that, you have to replace \n with <br />

In chrome, sometimes the "okay" button of the alert doesn't even show >_>

Warty
  • 7,237
  • 1
  • 31
  • 49
  • Going to have to mention this method is severely outdated unless you desire to see the intermediate state of your application. Opt for console.log as it is less intrusive. Also consider executing "debugger;" which will cause a breakpoint if you have chrome/firebug's console open. – Warty Feb 15 '15 at 08:17
1

Use a cross-browser logging library such as my own log4javascript. Among many other things, it has a searchable, filterable logging console and allows you to dump objects to the console using logging calls:

var obj = {
    name: "Octopus",
    tentacles: 8
};

log.debug(obj);

/*
   Displays:

   19:53:17 INFO  - {
     name: Octopus,
     tentacles: 8
   }
*/
Tim Down
  • 318,141
  • 75
  • 454
  • 536
1

Have a look at Blackbird. It's an onscreen javascript logger/debugger. In you code you would place log.debug(object) and it will be output to the browser in a div overlay. I don't know if it works if you just pass it an object, but apparently you already have the object.dumpvars() already worked out.

jspash
  • 191
  • 1
  • 6