Did you know: this website doesn't support this OLD Browser. Please Update it or

You should try out most popular browsers in the world Firefox or Google Chrome.

Autofill email using Javascript Cookie

You are here: Home » Tutorials » Jquery Java » Autofill email using Javascript Cookie
2       comments {by: } Posted in: Jquery Java

Here is a useful JavaScript code snippet which validates email and then saves it in a cookie for pre-filling or auto-fill email addresses in input fields

First to check email address

Paste this code in the head section of your HTML code


Explanation

Most of the upper part check email string, then in the end we need to call our cookieMan function for cookie creation. And this will only happen once the email validates. After cookie creation, we are opening a new thanks.html page for the user

Now Javascript Cookie creation code

Also paste this code in the head section of your html file



Explanation

If no cookie is present, it will create a new cookie with 15 days to expire. CookieMan function is setting the cookie values, its name, value and expiration date. In the end i am calling getCookie function to show already saved email addresses

Now HTML code

Paste this code inside the body section of your html file

Explanation

Please note that if you change the form name to anything else, remember to alter the name in JavaScript code too. Also i am using email input as “from” which is also used in Javascript code so dont get confused

Notes

Download Source Files


It took me hours to make this freebie, Please take few minutes to register, Thanks.Please Login or Register for access.


Just enjoy this code and share it with others, thanks a lot

Page 1 of 11

2 Responses to “Autofill email using Javascript Cookie”

  1. 1
  2. 2

    Fantastic post here. I am eager to read more!

Leave a Reply