Created
April 12, 2021 21:34
-
-
Save dorianmariecom/bdf981615b391197b836c9c7eb73aff3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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