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

117
Visualizações
Create cookie by clicking on a button

Javacript + html.

I have created an input of type "email" inside a form and a button. The user insert his mail to the input box, click the button and the input information will be saved to a cookie.

I have found that if the id name and onclick name on the button are similar it wouldn't work, I would like to understand why is that?

html:

<head>
    <title>Document</title>
    <link rel="stylesheet" href="main.css">
    <script src="main.js"></script>
</head>

<body>
    <form>
        <input id="input" type="email">
        <button id="saveMe" onclick="saveMe()">Save</button>
    </form>
</body>

</html>

JS:

function saveMe() {
    const input = document.getElementById("input")
    document.cookie = "Email=" + input.value
}
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