mirror of
https://github.com/docusealco/docuseal.git
synced 2026-08-07 07:14:43 +00:00
18 lines
434 B
JavaScript
18 lines
434 B
JavaScript
export default class extends HTMLElement {
|
|
connectedCallback () {
|
|
this.querySelectorAll('input[type="checkbox"]').forEach(checkbox => {
|
|
checkbox.addEventListener('change', this.handleChange)
|
|
})
|
|
}
|
|
|
|
handleChange = () => {
|
|
if (this.checkedCount !== 0) {
|
|
this.closest('form')?.requestSubmit()
|
|
}
|
|
}
|
|
|
|
get checkedCount () {
|
|
return this.querySelectorAll('input[type="checkbox"]:checked').length
|
|
}
|
|
}
|