X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/421dd93ffd59bbe881df1f7fa86066f7f353b596..refs/pull/1636/head:/resources/assets/js/components/toggle-switch.js diff --git a/resources/assets/js/components/toggle-switch.js b/resources/assets/js/components/toggle-switch.js index 3dd1ce85c..b9b96afc5 100644 --- a/resources/assets/js/components/toggle-switch.js +++ b/resources/assets/js/components/toggle-switch.js @@ -11,6 +11,11 @@ class ToggleSwitch { stateChange() { this.input.value = (this.checkbox.checked ? 'true' : 'false'); + + // Dispatch change event from hidden input so they can be listened to + // like a normal checkbox. + const changeEvent = new Event('change'); + this.input.dispatchEvent(changeEvent); } }