1

So I was using getElementById method and consoled it when I'm consoling with string it just displays string object like this [Object] i want to display it as Object

var element = document.getElementById('input');
console.log("the view element "+ element );
2
  • 2
    console.log("the view element ", element ); - use comma Commented Aug 16, 2016 at 19:23
  • Oh yeah (y) thanks man Commented Aug 16, 2016 at 19:26

3 Answers 3

1

you can try

console.log ('text', element)

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

0

console.log(element);

//Now you can explode the object

1 Comment

As in you really want the the view element text to be included? I don't know if you can do that on the same line. Break it into two lines?
0

console.dir is your friend.

var el = document.querySelector('div');
console.dir(el);
<div>Stuff</div>

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.