I am creating a cookie, but I need to remove A cookie based on a onclick event that I am trying to set, but is not working.
Here is how I am setting the cookie. Which works fine.
<script type="text/javascript">//<![CDATA[
$(window).load(function(){
$(".filter input").each(function() {
var mycookie = $.cookie($(this).attr('name'));
if (mycookie && mycookie == "true") {
$(this).prop('checked', mycookie);
}
});
$(".filter input").change(function() {
$.cookie($(this).attr("name"), $(this).prop('checked'), {
path: '/',
expires: 365
});
});
});//]]>
And then to delete I am trying to remove the cookie on click event based on an ID with out any luck, I am just not sure where I am going wrong here, would this work… ??? $.removecookie($(this).attr(‘name’), null, { path: ‘/’ }); see my code below.
<script>
jQuery('#dnn_ctr555_ProductSearch_rpData_cmdAdvReset_0').click(function() {
$.removeCookie($(this).attr('name'), { path: '/' });
}
</script>
Here is a fiddle http://jsfiddle.net/23nUZ/ any help would be awesome.