2012-01-21 37 views
0

我有一種搜索形式,更多的選擇,複選框,輸入(jQuery UI)。jQuery UI,Cookie

如何通過cookie保存所選元素,在提交壓力後,我可以更改一個值,但不能重新選擇一切?

回答

0

如果你想使用這個cookies,您可以使用jQuery插件餅乾https://github.com/carhartl/jquery-cookie

Create session cookie: 
$.cookie('the_cookie', 'the_value'); 

Create expiring cookie, 7 days from then: 
$.cookie('the_cookie', 'the_value', { expires: 7 }); 

Create expiring cookie, valid across entire page: 
$.cookie('the_cookie', 'the_value', { expires: 7, path: '/' }); 

Read cookie: 
$.cookie('the_cookie'); // => 'the_value' 
$.cookie('not_existing'); // => null 

Delete cookie by passing null as value: 
$.cookie('the_cookie', null); 
+0

我知道,我不知道如何使用jQuery UI的 –

+0

連接你必須clairfy你的問題。 – KMan

+0

如何在所有形式上行走,並記住所選元素?在頁面更新時,所選元素仍然被選中 –