import { Controller } from '@hotwired/stimulus'; export default class extends Controller { static values = { prompt: String, expect: String, }; handle(event) { const userInput = prompt(this.promptValue); if (userInput !== this.expectValue) { event.preventDefault(); alert('입력한 메시지가 일치하지 않습니다. 취소합니다.'); return false; } } }

AltStyle によって変換されたページ (->オリジナル) /