方法-入力フィールドをクリアする
フォーカスの入力フィールドをクリアする方法を学びます。
入力フィールドをクリックしてクリアします。
フォーカスの入力フィールドをクリア
例
<!-- When the input field gets focus, replace its current value with an
empty string -->
<input type="text" onfocus="this.value=''" value="Blabla">
ボタンで入力フィールドをクリア
例
<button onclick="document.getElementById('myInput').value = ''">Clear input
field</button>
<input type="text" value="Blabla" id="myInput">
ヒント: HTMLフォームの詳細については、 HTMLフォームチュートリアルにアクセスしてください。