Skip to content

multiple same id's #139

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
nerkn opened this issue Apr 22, 2011 · 2 comments
Open

multiple same id's #139

nerkn opened this issue Apr 22, 2011 · 2 comments

Comments

@nerkn
Copy link

nerkn commented Apr 22, 2011

Hi,
trashy code lead me to deal with multiple same id's, namely many id=start and id=end.

I handled them with assigning custom values

    datetimepickerI = 89297;
    $.timepicker.setDefaults($.timepicker.regional['tr']);
    $("input[name=\'start\'], input[name=\'end\']").each(function(){
        datetimepickerI++;
        this.id = 'datetimepicker'+datetimepickerI;
        $('#'+this.id).datetimepicker();
    }); 
@bemineni
Copy link

Multiple input elements with same ids on the same page doesn't work properly.

<div id="one">
<input id="date-time-picker"></input>
<div/>

<div id="two">
<input id="date-time-picker"></input>
<div/>
```html

$("#one #date-time-picker").datetimepicker();
$("#two #date-time-picker").datetimepicker();

@trentrichardson
Copy link
Owner

You should never have two elements with the same id on the same page. id
must be unique. Class names are better for that.
On Oct 11, 2015 11:22 AM, "Srikanth Bemineni" notifications@github.com
wrote:

Multiple input elements with same ids on the same page doesn't work
properly.

$("#one #date-time-picker").datetimepicker();
$("#two #date-time-picker").datetimepicker();


Reply to this email directly or view it on GitHub
#139 (comment)
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants