Make #ID or .Class?

Discussion in 'HTML & Website Design' started by x11joex11, Sep 28, 2007.

  1. #1
    Hey I have another quick question. I'm curious what in your opinions would be best option to use in the following situation.

    I know #ID is used for unique elements and .CLASS for elements that will be called multiple times, but what if I have a unique class for say different rollover images on an anchor.

    Since it's class (or ID?) will change upon mouseOver via Jquery (or some javascript equivalent commands), should I have my definitions be #ID or .CLASS. I'm thinking #ID because I'm only calling it in one place but it does change when mouseOver...so hmm...what is the proper thing to do here so that I follow proper form, or am I just being too anal about it :)? Let me know.
     
    x11joex11, Sep 28, 2007 IP
  2. krt

    krt Well-Known Member

    Messages:
    829
    Likes Received:
    38
    Best Answers:
    0
    Trophy Points:
    120
    #2
    It is fine to have a class that is only used once. Try and get into the mindset that if something can be appropriately repeated (regardless of whether you know it will/won't), it should be a class.
     
    krt, Sep 29, 2007 IP
  3. x11joex11

    x11joex11 Peon

    Messages:
    106
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Seems I was forced to set the ID's to Class type or else JQuery would not recognize the addClass removeClass Function (since there is no RemoveID Equivlent), so I did that for now, thanks for the insight though!
     
    x11joex11, Sep 29, 2007 IP