Treat getElementById return value as array?

You can simply create an array: else if (document. GetElementById('someId')) { obj = document. GetElementById('someId'); // note the array literal } The return value of getElementById will always be a DOM element, so you cannot change that.

IDs are supposed to be unique, so even if you have several elements with the same ID, it will return only one of them Given that getElementsByClassName does not exist in IE8 and below, you should also have a look at document. QuerySelectorAll docs (which at least works in IE8).

You can simply create an array: else if (document. GetElementById('someId')) { obj = document. GetElementById('someId'); // note the array literal } The return value of getElementById will always be a DOM element, so you cannot change that.

IDs are supposed to be unique, so even if you have several elements with the same ID, it will return only one of them. Given that getElementsByClassName does not exist in IE8 and below, you should also have a look at document. QuerySelectorAll docs (which at least works in IE8).

– testndtv Jul 20 at 7:00 @hmthr: Of course :) – Felix Kling Jul 20 at 7:24.

Just replace obj = document. GetElementById('someId'); with obj = document. GetElementById('someId').

Var obj = ; if (document. GetElementsByClassName('someClass')) { obj = document. GetElementsByClassName('someClass'); } else if (document.

GetElementById('someId')) { obj. Push(document. GetElementById('someId')); }.

You can use this obj = ; obj. Push(document. GetElementById('someId')).

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions