First, to display the cookie, I used the electrictoolbox.com code .
Then I made a form to add a cookie:
<form class="cokies" method="post">
<input class="query" name="q" type="text" />
<input type="submit" name="save" value="saving">
<a>Delete Cookies</a>
</form>
$(document).ready(function(){
$('.cokies a').click(function(){
$.cookie('q', null);
});
remember('[name=q]');
This feature is from komodomedia.com :
function remember( selector ){
$(selector).each(function(){
var name = $(this).attr('name');
if( $.cookie( name ) ){
$(this).val( $.cookie(name) );
}
$(this).change(function(){
$.cookie(name, $(this).val(), { path: '/', expires: 365 });
});
});
}
The problem is that I cannot decide how to delete the cookie.
source
share