0

document.getElementById("ViewSearchBar") is returning Dom object like [object Object] in IE11, where as the same query Returns Dom element in Edge like <span id='ID'>. Hence I am confused, as properties and methods differ on the way the output is rendered. Also please let me know why we see that difference.

Andy
  • 61,948
  • 13
  • 68
  • 95
  • 2
    It is _not_ returning `[object object]` in IE11, IE11 just does not print these elements as anything other than that description. In memory, its the same object and it works the same. `[object object]` is printed by IE since that is its description, since IE's console does not log anything but direct values. For example, an array in IE11 is `[object array]` and not `[1,2,3]`... Have a look here: http://stackoverflow.com/questions/2434613/console-log-in-ie-on-an-object-just-outputted-object-object – somethinghere Apr 04 '16 at 13:29
  • Forgot to mention, this is being seen in developer tools, EX:document.getElementById("ViewSearchBar").all is working fine in IE11, but the same breaks in edge, as its returning Tag. Please let me know if i am missing something – Shashank Bs Apr 04 '16 at 13:36
  • What is `.all` on a node and what is it supposed to do? I have honestly never seen this before. The reason this is important is because it makes no sense to have something called `all` in a single selector function. It either returns ONE node or NONE. I cannot find the `.all` in any documentation, so let me know what it is for. – somethinghere Apr 04 '16 at 13:42
  • http://stackoverflow.com/questions/2408424/document-all-vs-document-getelementbyid. Here its mentioned about document.all – Shashank Bs Apr 04 '16 at 13:45
  • This might help : https://social.msdn.microsoft.com/Forums/en-US/009df27c-04bf-453c-bd80-c56eb6fbb6f5/howto-replace-elementall-for-ie11-and-previous-ie-versions?forum=iewebdevelopment – HBP Apr 04 '16 at 13:46
  • Then what is this ungodly mix of both supposed to do anyhow (`document.getElementById("ViewSearchBar").all`)? Have a look into non-proprietary web technologies like `querySelector` and `querySelectorAll` and **forget about things like _all_**. – somethinghere Apr 04 '16 at 13:59

0 Answers0