skip to Main Content

Why inputElement.maxLength returns -1? – Html

I wonder why default maxLength/minLength property for HTMLInputElement is set to -1 by default. There is also confusing behavior like below: Example <input type="text" /> const inputElement = document.querySelector('input'); console.log(inputElement.maxLength) // -1 I set maxLength programatically inputElement.maxLength = 2; console.log(inputElement.maxLength)…

VIEW QUESTION
Back To Top
Search