javascript - jQuery Cookie When Form Submit -


i'm not expert in jquery, have code can save checkboxes cookies when checked it, 2 hours

 $(document).ready(function(){           $('input[type=checkbox]').each(function() {     var mycookie = $.cookie($(this).attr('value'));     if (mycookie && mycookie == "true") {         $(this).prop('checked', mycookie);     } });  $('input[type=checkbox]').change(function() {     var date = new date();     var minutes = 60;     date.settime(date.gettime() + (minutes * 60 * 1000));     $.cookie($(this).attr("value"), $(this).prop('checked'), {     path: '/',     expires: date     }); }); 

i need use same above code , adding simple make me able expire cookies time when submit .but if user did not submit form checkboxes cookies stay till time finish .

how can dot ?

in order expire cookie @ form submit can this,

$(document).ready(function () {     $('#form').submit(function (e) {         document.cookie = "yourcookiename=; expires=thu, 01 jan 1970 00:00:00 utc";      }); }); 

Comments

Popular posts from this blog

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -