Skip to content

Instantly share code, notes, and snippets.

@dorianmariecom
Created April 12, 2021 21:34
Show Gist options
  • Save dorianmariecom/bdf981615b391197b836c9c7eb73aff3 to your computer and use it in GitHub Desktop.
Save dorianmariecom/bdf981615b391197b836c9c7eb73aff3 to your computer and use it in GitHub Desktop.
import { Controller } from "stimulus"
export default class extends Controller {
static targets = ["input"]
connect() {
this.update()
}
update() {
const checked = this.inputTarget.checked
if (checked) {
this.element.classList.add("checked-border--checked")
} else {
this.element.classList.remove("checked-border--checked")
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment