Search the Community
Showing results for tags 'placeholder'.
Found 1 result
-
Olá Pessoal, Há muito tempo não desenvolvo e já esqueci muitas coisas, então gostaria de saber se alguém pode me auxiliar, estou fazendo um cadastro aonde necessito saber se o cliente esta registrando através do CNPJ ou CPF e então mudar a nomeclatura no campo texto placeholder="CNPJ DA EMPRESA" quando o usuário clicar no Radio de seleção. Ou seja quando clicar no Radio CPF mudar o campo texto para CPF. além disso validar o campo. Alguém pode me auxiliar, o Exemplo abaixo funcionou até um certa etapa. <html> <head> <title></title> <script> function exibeMsg( valor ) { switch (valor) { case '1': document.getElementById( 'txt' ).innerHTML = 'Cadastro com CPF'; break; case '2': document.getElementById( 'txt' ).innerHTML = 'Cadastre com CNPJ'; break; default: document.getElementById( 'txt' ).innerHTML = 'Selecione se você esta cadastrando sua empresa pelo CNPJ ou CPF, ela será usada para fazer login no site'; break; } } </script> </head> <body> <label> <input type="radio" name="tipocadastro" value="1" id="" onchange="exibeMsg(this.value);"> Cadastro com CNPJ</label> <br> <label> <input type="radio" name="tipocadastro" value="2" id="" onchange="exibeMsg(this.value);"> Cadastro com CPF</label> <br> </p> <br/> <span id="txt">Nenhum valor informado</span> <div class="container"> <div class="row"> <div class="form-group col-md-5"> <input type="text" class="form-control" id="txt" placeholder="CNPJ DA EMPRESA" required name="CNPJEmpresa" onchange="exibeMsg(this.value);"> </div> </div> </div> </body> </html>
- 1 reply
-
- placeholder
- radio
-
(and 5 more)
Tagged with: