[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.javascript

problem same element objetc

WALID BELRHALMIA

9/10/2015 2:51:00 PM

i have a question when we do var e= document.getElemtById("foo") i get the object>Node>element that it hase id="foo" . But when i do e===document.getElemtById("foo") i get true it's the same object it return always the some object can someone explain me how that work
3 Answers

Evertjan.

9/10/2015 3:12:00 PM

0

WALID BELRHALMIA <wbelrhalmia@gmail.com> wrote on 10 Sep 2015 in
comp.lang.javascript:

> i have a question when we do var e= document.getElemtById("foo") i get
> the object>Node>element that it hase id="foo".

No, you do NOT.

document.getElemtById(

should be

document.getElementById(

> But when i do
> e===document.getElemtById("foo") i get true

Same objection, you do not.

> it's the same object it
> return always the some object

Do you mean "the same object"?
If so, ofcourse,
if you request a pointer to a node twice
you get the same node twice.

> can someone explain me how that work

Why are you asking?
What do you want to accomplish?
This is not schoolwork, or is it?


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Sam Desborough

9/10/2015 6:44:00 PM

0

On Thursday, September 10, 2015 at 3:50:56 PM UTC+1, WALID BELRHALMIA wrote:
> i have a question when we do var e= document.getElemtById("foo") i get the object>Node>element that it hase id="foo" . But when i do e===document.getElemtById("foo") i get true it's the same object it return always the some object can someone explain me how that work

It's the same as saying 1 === 1.

Evertjan.

9/10/2015 7:05:00 PM

0

Sam Desborough <sam.desborough@gmail.com> wrote on 10 Sep 2015 in
comp.lang.javascript:

> On Thursday, September 10, 2015 at 3:50:56 PM UTC+1, WALID BELRHALMIA
> wrote:
>> i have a question when we do var e= document.getElemtById("foo") i get
> the object>Node>element that it hase id="foo" . But when i do
> e===document.getElemtById("foo") i get true it's the same object it
> return always the some object can someone explain me how that work
>
> It's the same as saying 1 === 1.

That might be true in a steady state.

However, things could have changed between the assignment of e
and the subsequent comparison in a way that the id has moved
[was signed] to another node.

> saying 1 === 1

That English has "one and another one" goes without saying.

Ah well, let's stipulate you are right, Sam.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)