Skip to content

Instantly share code, notes, and snippets.

@cahva
Created October 29, 2019 13:40
Show Gist options
  • Select an option

  • Save cahva/81ba91bb10eedb65eab401cb76d4677d to your computer and use it in GitHub Desktop.

Select an option

Save cahva/81ba91bb10eedb65eab401cb76d4677d to your computer and use it in GitHub Desktop.
Change maxLenght of register form inputs
<script>
function tryEl(e) {
var privEl = document.querySelector('.register-form');
if (!privEl) {
window.requestAnimationFrame(tryEl);
} else {
changeForm(privEl);
}
}
function changeForm(el) {
var inputs = document.querySelectorAll('input[type=text],input[type=email]');
if (inputs && inputs.length) {
for (var i = 0; i < inputs.length; i++) {
inputs[i].maxLength = 30;
}
}
}
tryEl();
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment