HTML: Password Text Field

By Xah Lee. Date: . Last updated: .

What is Masked Text Field

Masked text field is used for passwords. What user typed won't be shown.

Password Field Example


Result:

Code

<label for="passwordBox29732">password:</label>
<input id="passwordBox29732" type="password" size="30" maxlength="30" name="password">

<p>Result:
<span id="showBox13293"></span></p>
{
  const passwordBox29732 = document.getElementById("passwordBox29732");
  const showBox13293 = document.getElementById("showBox13293");

  const f_update = () => {
    showBox13293.textContent = showBox13293.value;
  };

  passwordBox29732.addEventListener("input", f_update, false);
}

HTML Input tutorial