GetElementById doesn't work

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hi,
I have a very simple code:

<div style="color:black; background-color:white
<pre><span style="color:green // This code line returns null
<span style="color:blue var element = xmlDocument.GetElementById(<span style="color:#a31515 "myElementId");
<span style="color:green // And this one returns element with ID myElementId
element = xmlDocument.GetElementsByTagName(<span style="color:#a31515 "*").OfType<XmlElement>().FirstOrDefault(element => element.HasAttribute(<span style="color:#a31515 "id") && element.GetAttribute(<span style="color:#a31515 "id") == <span style="color:#a31515 "myElementId");
[/code]

<br/>
What is the reason of such GetElementById behavior? Why it can not find element with myElementId ID?<br/>

<br/>
<br/>

View the full article
 
Back
Top