diff --git a/js/src/button.js b/js/src/button.js index 8b9511765767..45e1424ffdcf 100644 --- a/js/src/button.js +++ b/js/src/button.js @@ -90,7 +90,7 @@ const Button = (($) => { if (triggerChangeEvent) { input.checked = !$(this._element).hasClass(ClassName.ACTIVE) - $(this._element).trigger('change') + $(input).trigger('change') } input.focus() diff --git a/js/tests/unit/button.js b/js/tests/unit/button.js index 7fd86e13a562..d87b57610292 100644 --- a/js/tests/unit/button.js +++ b/js/tests/unit/button.js @@ -72,6 +72,26 @@ $(function () { assert.strictEqual($btn.attr('aria-pressed'), 'true', 'btn aria-pressed state is true') }) + QUnit.test('should trigger input change event when toggled button has input field', function (assert) { + assert.expect(1) + var done = assert.async() + + var groupHTML = '