Skip to main content

Search and Top Navigation

#3460 closed enhancement (notabug)

Opened September 25, 2008 04:57PM UTC

Closed September 25, 2008 11:02PM UTC

Last modified October 11, 2012 09:15PM UTC

conflict if multiple input with same ID exists. Changed the code to use classes.

Reported by: g_gus Owned by: grabanski
Priority: minor Milestone:
Component: ui.datepicker Version:
Keywords: multiple id classes Cc:
Blocked by: Blocking:
Description

I have a code I can't modify, and unfortunately there are some input boxes with same ID.

In this case, the datepicker only updates the first one. (in this case I have some datepickers inside a lightbox. I can't really know if the IDs of the page that contains the lightbox won't conflict..)

I changed the code to work on classes instead than on IDs. I'm posting my code here so in case you can have a look at it.

Attachments (1)
  • ui.datepicker.js (71.9 KB) - added by g_gus September 25, 2008 04:58PM UTC.

    source with the code changed to manage the target element via class instead than via ID

Change History (3)

Changed September 25, 2008 05:03PM UTC by g_gus comment:1

Basically the code changes are theese:

First, store the information about the target into a Class (creating always a new string via uuid

dp_class = 'dp' + ++this.uuid; 
$(target).addClass(dp_class);
$(target).attr('dp_class',dp_class);

then in _newInst just return a class instead than a id:

return {class: target.attr('dp_class'), ...

and then the code changes all the queryes from #init.id to .init.class

that's it.

Changed September 25, 2008 11:02PM UTC by scottgonzalez comment:2

resolution: → invalid
status: newclosed

Multiple elements can't have the same id. This is invalid HTML and is therefore unsupported.

Changed October 11, 2012 09:15PM UTC by scottgonzalez comment:3

milestone: TBD

Milestone TBD deleted