A best practice I've adopted is to utilize classes and ref/rel
attributes on dom elements for situations like you're describing.

<div class="event-phase" rel="1"></div>
<div class="event-phase" rel="2"></div>
<div class="event-phase" rel="3"></div>
<div class="event-phase" rel="4"></div>
<div class="event-phase" rel="5"></div>

Instead of

<div id="event-phase-1"></div>
<div id="event-phase-2"></div>
<div id="event-phase-3"></div>
<div id="event-phase-4"></div>
<div id="event-phase-5"></div>

On Mar 31, 12:31 pm, brian <bally.z...@gmail.com> wrote:
> An ID should be unique. That's why it's callled an ID (IDentifier).
> Repeating an ID in a page will cause problems for any DOM work.
>
> For your purposes, you might do something like:
>
> <div class="Foo" id="foo_1"></div>
> <div class="Bar" id="bar_1"></div>
> <div class="Foo" id="foo_2"></div>
> <div class="Bar" id="bar_2"></div>
>
> On Tue, Mar 31, 2009 at 12:24 PM, riotbrrd <k...@riotbrrd.com> wrote:
>
> > I realize this is not jQuery specific, but I figured you guys might
> > have some good advice...
>
> > I often find myself wanting to assign the same ID to multiple elements
> > in a document -- typically when there are several versions of an
> > element which display at different times. Is there a good reason NOT
> > to do this? If so, what's a better practice?
>
> > thanks,
> > Kim

Reply via email to