Search code examples
htmldommshtml

Does the ID's of DOM change from browser to browser?


In C#, I am using the mshtml.HTMLDocument to retrieve various elements from a page.

For example:

button = (mshtml.HTMLButtonElement)theDoc.getElementById("ID1");

Now, if I am running IE6,IE7,IE8, will "ID1" change depending on browser version?


Solution

  • No, ID is an attribute of the tag. So if you have

    <input type="button" id="ID1" ... /> 
    

    It's ID will be ID1 in all browsers.