Skip to content

Instantly share code, notes, and snippets.

View fatecitu's full-sized avatar

Prof. Ricardo Leme - Fatec Itu fatecitu

  • Fatec Itu
  • Itu, SP, Brazil
View GitHub Profile
@fatecitu
fatecitu / estilo.css
Created September 2, 2025 22:43
CSS Exemplo
body {
font-family: Arial, sans-serif;
background-color: #f7f7f7;
display: flex;
flex-direction: column;
align-items: center;
padding: 20px;
}
.container {
@fatecitu
fatecitu / formataRG.js
Last active May 24, 2023 01:10
Formatar RG com JS
function formatarRG(campo) {
// Remove caracteres não numéricos
var rg = campo.value.replace(/\D/g, '');
// Adiciona pontos e traço conforme o usuário digita
rg = rg.replace(/(\d{2})(\d)/, '$1.$2');
rg = rg.replace(/(\d{3})(\d)/, '$1.$2');
rg = rg.replace(/(\d{3})(\d{1,2})$/, '$1-$2');
// Verifica se o último dígito é X e adiciona a string de retorno