Merhaba arkadaşlar. Sitemde bir form hazırladım ve şu kodu kullanıyorum.
<head>
<title></title>
<script src="Scripts/jquery-1.7.1.min.js" type="text/javascript"></script>
<script src="https://github.com/carhartl/jquery-cookie/blob/master/jquery.cookie.js"
type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
var checkbox = $('#boxlawreg').find(':checkbox'), checkboxCookieName = 'checkbox-state';
checkbox.each(function () {
$(this).attr('checked', $.cookie(checkboxCookieName + '|' + $(this).attr('name')));
});
checkbox.click(function () {
$.cookie(checkboxCookieName + '|' + $(this).attr('name'), $(this).prop('checked'));
});
});
</script>
</head>
<body>
<div id="boxlawreg">
<input type="checkbox" name="option1" value="1" />1<br />
<input type="checkbox" name="option2" value="2" />2<br />
<input type="checkbox" name="option3" value="3" />3<br />
<input type="checkbox" name="option4" value="4" />4<br />
</div>
</body>fakat bu kodda şöyle bir sıkıntım var. Tıkladığında checkboxa eğer check olmuşsa cookie oluşturuyor. Buraya kadar herşey guzel. Ama checkbox uncheck yapsanız bile gene eskı aldığı cookie yi silmiyor. Bunu checkbox uncheck olduğunda eski aldığın cookie yi sil komutunu nasıl ekleriz acaba. Bir türlü bunu yapmayı başaramadım. Yardımlarınız bekliyorum.