Bad practice multiple elements with same ID?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jezternz
    New Member
    • Jan 2008
    • 145

    Bad practice multiple elements with same ID?

    Okay,
    Basicly I want to style multiple input fields with a new border, background ect.
    However when I use a class they do not change in FF, when I give them all the same ID they do change in FF. I am building a web application, however all elements are accessed through javascript references and I do not access anything via getElementById, so from my point I do not need them to have different ID's.
    But I was wondering if it breaks or damages the DOM at all? is it bad practice? and does this make it invalid xhtml?

    Thanks, Josh
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    Originally posted by Jezternz
    But I was wondering if it breaks or damages the DOM at all? is it bad practice? and does this make it invalid xhtml?
    No, Yes, Yes.

    well, it's what an ID is about, an identifyer. ( I never had problem through styling with classes…)

    Comment

    • Markus
      Recognized Expert Expert
      • Jun 2007
      • 6092

      #3
      Maybe you can show us how you're styling the classes?

      Comment

      • Jezternz
        New Member
        • Jan 2008
        • 145

        #4
        Have started working on something else, but will post my code when I get a chance.

        Comment

        Working...