Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

116
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!