-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathform1.html
91 lines (84 loc) · 2.43 KB
/
form1.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Formulário com jQuery</title>
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<script type="text/javascript" src="js/jquery-3.4.1.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/jquery.mask.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#cpf").mask("000.000.000-00")
$("#cnpj").mask("00.000.000/0000-00")
$("#telefone").mask(" (00) 0000-0000")
$("#salario").mask("999.999.990,00",{reverse: true})
$("#cep").mask("00.000-000")
$("#dataNascimento").mask("00/00/0000")
$("#rg").mask("999.999.999-W", {
translation: {
'W': {
pattern: /[X0-9]/
}
},
reverse: true
})
var options = {
translation: {
'A': {pattern: /[A-Z]/},
'a': {pattern: /[a-zA-Z]/},
's': {pattern: /[a-zA-Z0-9]/},
'L': {pattern: /[a-z]/},
}
}
$("#placa").mask("AAA-0000", options)
$("#codigo").mask("AA.LLL.0000", options)
$("#celular").mask(" (00) 0000-00009")
$("#celular").blur(function(event){
if ($(this).val().length == 15){
$("#celular").mask(" (00) 00000-0009")
}else{
$("#celular").mask("(00) 0000-00009")
}
})
})
</script>
</head>
<body>
<h1>JQuery Mask Plugin</h1>
<form name="formulario" method="post">
<label>CPF</label>
<input type="text" name="cpf" id="cpf" />
<br />
<label>CNPJ</label>
<input type="text" name="cnpj" id="cnpj" />
<br />
<label>RG</label>
<input type="text" name="rg" id="rg" />
<br />
<label>Telefone</label>
<input type="text" name="telefone" id="telefone" />
<br />
<label>Celular</label>
<input type="text" name="celular" id="celular" />
<br />
<label>Salário</label>
<input type="text" name="salario" id="salario" />
<br />
<label>Cep</label>
<input type="text" name="cep" id="cep" />
<br />
<label>Data de Nascimento</label>
<input type="text" name="dataNascimento" id="dataNascimento" />
<br />
<label>Placa</label>
<input type="text" name="placa" id="placa" />
<br />
<label>Código</label>
<input type="text" name="codigo" id="codigo" />
<br />
<input type="submit" name="enviar" value="Enviar" />
</form>
</body>
</html>