htmlinputletter

Is there a way to make an input only accept one letter in HTML?


I'm working on an Wordle remake in HTML, and I want to make separate inputs for each letter, but I don't know how to make the input only accept one letter. Is there any way to make an input only accept one letter?


Solution

  • Sure you can. Using the maxlength attribute.

    <input type="text" maxlength="1">