<form action="">
    <input maxlength="4">
    <button type="submit">submit</button>
</form>