Ir ao conteúdo
  • Cadastre-se

isaborges

Membro Júnior
  • Posts

    2
  • Cadastrado em

  • Última visita

posts postados por isaborges

  1. Boa tarde, Pessoal!

    Estou fazendo um exercício e não estou conseguindo fazer a parte de validação. 

    O meu código está assim:

    <!DOCTYPE html>
    <html lang="pt-br">
    <head>
        <meta charset="UTF-8">
        <script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
        <title>Exercicio 02 </title>
    </head>
    <body>
        <form action="#">
        <h3>Cadastro</h3>
        <p>
        <label for="campotexto">Nome: </label>
        <input type="text" name="campoTexto" id="campoTexto" required>
        </p>
        <p>
        <label for="email">E-mail:</label>
        <input type="email" name="email" id="email" required>
        <p>
        <label for="telefone">Telefone: </label>
        <input type="telefone" name="telefone" id="telefone">
        </p>
        <label for="telefone">Celular: </label>
        <input type="telefone" name="telefone" id="telefone">
           </p>
        </label>
    
    <form id="form">
         <input type='radio' name='tipopessoa' id='fisica'> CPF
         <input type='radio' name='tipopessoa' id='juridica'> CNPJ
         <div id="documentType">
             <label></label>
             <input id='' type='text' name=''>
         </div> <br><br>
    </form>
        
    <script>
    
    $(function() {
        var documentType = $('#documentType');
        documentType.hide();
        function showInput(id) {
            if(id =='fisica') {
                $('#documentType label').text('CPF');
                $('#documentType input').prop('name','cpf');
                $('#documentType input').prop('id','cpf');
                documentType.show();
            }
            if(id =='juridica') {
                $('#documentType label').text('CNPJ');
                $('#documentType input').prop('name','cnpj');
                $('#documentType input').prop('id','cnpj');
                documentType.show();
            }
        }
        $(document).on('click', 'input[type=radio]', function(){
            var id = $(this).prop('id');
            showInput(id);
        });
    });
    
    </script> 
    
    <script>    function HabiDsabi(){  if(document.getElementById('habi').checked == true)
    {document.getElementById('envia').disabled = ""  }  if(document.getElementById('habi').checked == false)
    {    document.getElementById('envia').disabled = "disabled"  }  }
        </script>
        <form name="form1"><input type="checkbox" name="habi" id="habi" onClick="HabiDsabi()">Concordo sem Ler
            <br>
        <input type="submit" name="envia" id="envia" value="Cadastrar" disabled>
    
    </form>
    
    
    </body>
    </html>

     

    Anexo está a imagem do que foi pedido no exercício. 

    Ps: Estou iniciando o estudo, agradeço desde já a disponibilidade em ajudar. 

    exe02.jpeg

Sobre o Clube do Hardware

No ar desde 1996, o Clube do Hardware é uma das maiores, mais antigas e mais respeitadas comunidades sobre tecnologia do Brasil. Leia mais

Direitos autorais

Não permitimos a cópia ou reprodução do conteúdo do nosso site, fórum, newsletters e redes sociais, mesmo citando-se a fonte. Leia mais

×
×
  • Criar novo...

 

GRÁTIS: ebook Redes Wi-Fi – 2ª Edição

EBOOK GRÁTIS!

CLIQUE AQUI E BAIXE AGORA MESMO!