diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f86f85c31..36959026e5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ ## Unreleased * Change id validation on component wrapper ([PR #4584](https://github.com/alphagov/govuk_publishing_components/pull/4584)) +* Add another: fix problem in createRemoveButtons method ([PR #11719](https://github.com/alphagov/govuk_publishing_components/pull/4586)) ## 50.0.0 diff --git a/app/assets/javascripts/govuk_publishing_components/components/add-another.js b/app/assets/javascripts/govuk_publishing_components/components/add-another.js index 6b7d787dcb..d4c4a32fb8 100644 --- a/app/assets/javascripts/govuk_publishing_components/components/add-another.js +++ b/app/assets/javascripts/govuk_publishing_components/components/add-another.js @@ -49,7 +49,7 @@ window.GOVUK.Modules = window.GOVUK.Modules || {}; AddAnother.prototype.createRemoveButtons = function () { var fieldsets = - document.querySelectorAll('.js-add-another__fieldset') + this.module.querySelectorAll('.js-add-another__fieldset') fieldsets.forEach(function (fieldset) { this.createRemoveButton(fieldset, this.removeExistingFieldset.bind(this)) fieldset.querySelector('.js-add-another__destroy-checkbox').hidden = true