Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

101
Visualizações
name attribute inhibits onclick function

The code below works fine, it changes the type of password to reveal the input as text. The prolem appears when adding a name attribut to "password" in order to retrieve data from $POST in php. I thought there might be a way to get the data on serverside without a "name", but my reasearch showed that without a "name" attribute no data can be retrieved.

Question: How to bring in the name attribute and keep my functionality?

            <div>
                <label for="password">Passwort (8 min. pls. )</label>
                <input type="password" id="password" minlenght="8" required>
            </div>
            <div>
                <label for="anzeigen">Passwort anzeigen</label>
                <input type="checkbox" onclick="anzeigen()" >
            </div>
            <div>
                <input type="submit" id="mitmachen" value="mitmachen">
            </div>
        </form>
        <script>
            function anzeigen() {
                var x = document.getElementById("password");
                if (x.type === "password") {
                    x.type = "text";
                }else {
                    x.type = "password";
                }
            }
        </script>
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda