Reputation: 18639
I have an object. If I just do an alert on it, it shows this: [object HTMLInputElement] but doesn't show the value. If I do this
document.getElementById('rout_markers').value
then it shows nothing. Does that mean it isn't set at all? Whats the best way to check if it is null?
Upvotes: 0
Views: 223
Reputation: 1038730
FireBug is very good for this purpose. It has a logging console where you can inspect/debug javascript. So:
console.log(document.getElementById('rout_markers'));
and then enjoy the results in the console. It will contain answers to your questions.
Upvotes: 4
Reputation: 222118
If you're on Firefox (Firebug) or Google Chrome, you can do
console.log(document.getElementById('rout_markers'));
Upvotes: 3
Reputation: 62392
I'm assuming this is for debugging purposes
In that case I would suggest using
console.log(object);
This prints out a collapsable/expandable tree view of the entire object into your javascript console (firebug, chrome console, etc...)
Upvotes: 3