a11yist/app/javascript/controllers/check_link_controller.js
david e569bcb246
Some checks failed
/ Run tests (push) Successful in 1m52s
/ Run system tests (push) Failing after 2m3s
/ Build, push and deploy image (push) Successful in 1m45s
Cosmetics
2024-11-11 05:00:51 +01:00

16 lines
434 B
JavaScript

import { Controller } from "@hotwired/stimulus"
// Connects to data-controller="check-link"
export default class extends Controller {
static targets = ["input", "button"]
connect() {
this.inputTarget.addEventListener("input", e => this.onUrlInputChange(e))
}
onUrlInputChange(event) {
this.buttonTarget.href = this.inputTarget.value;
this.buttonTarget.innerHTML = this.inputTarget.value;
return true;
}
}