我正在尝试设置 jquery cookie,但我无法让它工作。这是我正在使用的代码...
<div id="tabs-5">
<form>
<fieldset id="units" name="units">
<legend>Units</legend>
<center>
<div id="radio">
<label title="Select units of measurement to work with, Inches or Millimeters"></label>
<label for="inches">Inches</label>
<input type="radio" id="inches" name="unit" value="inches" onclick='valInches();' />
<label for="mm">Millimeters</label>
<input type="radio" id="mm" name="unit" value="mm" onclick='valMm();' />
</div>
</center>
</fieldset> <!--end "units"-->
</form>
</div> <!-- end tabs-5-->
$(function() {
var selected = $.cookie('radio'); // Retrieve cookie value
$('input[name="unit"][value="' + selected + '"]').attr('checked', true); //Check matching button
$('input[name="unit"]').click(function() {
$.cookie('radio', $(this).val(), {expires: 365}); // Save cookie
});
});