Reputation: 478
I am trying to change the cookie on a page after a simple form is submitted. Here is the code:
<script>
function setnewCookie(){
var frack = $('.value').text();
var exp = new Date(); // make new date object
exp.setTime(exp.getTime() + (1000 * 60 * 60 * 24 * 30)); // set it 30 days ahead
setCookie("phoneC", frack, exp); //save the cookie
}
</script>
The var frack = $('.value').text(); seems to be where the issue is. The .value is a class in a span tag with a simple phone number. I want to pass that phone number into the cookie. Can anyone tell me why this isnt working?
Upvotes: 0
Views: 228
Reputation: 98
You can use this jQuery library and it might save you time and frustration. Very easy to use
Upvotes: 2