Skip to content
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

id clash #39

Open
skwzrd opened this issue Apr 18, 2023 · 0 comments
Open

id clash #39

skwzrd opened this issue Apr 18, 2023 · 0 comments

Comments

@skwzrd
Copy link

skwzrd commented Apr 18, 2023

The cloned template/row that is being created duplicates ids. To address this, you can do the following,

// Disable all form elements inside the row template
$(container).children(self.settings.template).hide().find(':input').each(function() {
  $(this).prop('disabled', true);
  $(this).prop('id', '_' + this.id); // <------------------------ add this line
});
// Enable all form elements inside the row template
$(row_template).find(':input').each(function() {
  $(this).prop('disabled', false);
  $(this).prop('id', this.id.substr(this.id.indexOf('_') + 1)); // <--------------------- add this line
});

No more duplicate ids 😄

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

1 participant