I just wanted to know if we could get the maxlength of an input field from javascript
<input type="password" id="password" maxlength="20" >
I tried this but it returns undefined
console.log(document.getElementById("password").maxlength);
Use DOMElement::getAttribute()
to obtain properties, that not listed in DOMElement, but existing in markup:
var el = document.getElementById("password");
console.log(el.getAttribute('maxlength'));