Created
November 22, 2024 19:38
-
-
Save desenvolvendositeswp/122e0960ef605400d7183a529e164722 to your computer and use it in GitHub Desktop.
Mascara para JetFormBuilder para todos os input Text
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Todos os input tipo TEXT começarem com letras maiusculas*/ | |
document.addEventListener('DOMContentLoaded', function() { | |
// Selecione todos os campos que você deseja aplicar a máscara | |
const campos = document.querySelectorAll('input[type="text"]'); // ou outro seletor de campo | |
campos.forEach(function(campo) { | |
campo.addEventListener('input', function() { | |
// Converte a primeira letra de cada palavra para maiúscula | |
this.value = this.value.replace(/\b\w/g, function(letra) { | |
return letra.toUpperCase(); | |
}); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment