Sha256: 172486ec695e61fbc2a6476c90cff128a8628e4d9ecf2d52ce006a14492a2b7c
Contents?: true
Size: 502 Bytes
Versions: 11
Compression:
Stored size: 502 Bytes
Contents
import { Controller } from "@hotwired/stimulus"; export default class extends Controller { connect() { this.button = this.element.querySelector("button"); this.checkmark = this.button.querySelector("span"); } toggle() { if (this.checkmark.classList.contains("hidden")) { this.checkmark.classList.remove("hidden"); this.button.dataset.state = "checked"; } else { this.checkmark.classList.add("hidden"); this.button.dataset.state = "unchecked"; } } }
Version data entries
11 entries across 11 versions & 1 rubygems