Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5

Thread: Unique ID's

  1. #1
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts

    Unique ID's

    Are the following id's considered to be unique?

    id="myDiv"

    id="mydiv"
    The silent one.

    The most dangerous thing in the world is an idea.
    The most dangerous person in the world is the one with an idea.

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    In javascript they seem to be but from an html stand point, they can't be in the same document as html considers them the same.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    I thought it might be something on those lines

    IE7 treats them both as the same whereas Firefox conciders them both unique
    The silent one.

    The most dangerous thing in the world is an idea.
    The most dangerous person in the world is the one with an idea.

  • #4
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,642
    Thanks
    0
    Thanked 649 Times in 639 Posts
    HTML is NOT case sensitive and so if the page is HTML then they are the same.

    XHTML is case sensitive and so if your page is defined and served as XHTML then they would be two different ids. IE doesn't support XHTML served as XHTML though and so the only way to get XHTML to work with IE is to serve it as HTML.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #5
    Senior Coder Arbitrator's Avatar
    Join Date
    Mar 2006
    Location
    Splendora, Texas, United States of America
    Posts
    3,387
    Thanks
    32
    Thanked 288 Times in 282 Posts
    Quote Originally Posted by felgall View Post
    HTML is NOT case sensitive and so if the page is HTML then they are the same.
    According to the relevant part of the HTML 4.01 specification, the value of the id attribute is case‐sensitive. That seems to mean case‐insensitive handling is a bug in Internet Explorer up to version 7; this seems to be confirmed here and here. According to the second secondary source, Mr J’s example code would also be invalid if both IDs were used in the same document because case‐insensitive matches are not permitted for names and IDs.
    Last edited by Arbitrator; 12-27-2006 at 10:21 PM. Reason: Additional information added.
    For every complex problem, there is an answer that is clear, simple, and wrong.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •