Skip to content
Advertisement

Creating cookie with a form values makes a null cookie

First of all, i need to create a cookie with a values that are in a form, and a lot of values are in a radio input type, but i ran into a problem with creating it.

Here is the code:

JavaScript

i got the code for all the functions from tutorialrepublic.com except the last one, which i made on my own. it should create a cookie from the values which i choose in a form when i click the button here:

JavaScript

Fortunately, it creates a cookie, but with a null value. i consider that the problem is with the form values types,or with the form itself,but can’t see how i can fix this. i’m new in javascript so this problem can be easy to fix for you. can you help me to find my mistakes?

Advertisement

Answer

Code is totally ok, the problem is not with the code, but with my browser. the main thing is thath Google Chrome doesn’t allow to make a cookie from a local file, and needs at least a server. if you open this code in Firefox, it will work, but till you close the browser

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement