当我点击按钮保存时,我正在尝试保存用户的当前位置,我正在使用插件“jquery.cookie.js”
HTML
<div id="popup-saveSearch">
<!-- Save Cookie -->
<input type="text" id="locationName">
<button>Save</button>
<!-- Show all Cookies Saved -->
<table>
<tr>
<td class="location"><a href="#location1">cookie saved 1</a></td>
<td class="location"><a href="#location2">cookie saved 2</a></td>
<td class="location"><a href="#location3">cookie saved 3</a></td>
...
</tr>
</table>
</div>
的jQuery
// Save cookie
$("#popup-saveSearch button").on('click',function(){
var location = $("#locationName").val();
var pathUrl = window.location.href;
$.cookie('name',location);
$.cookie("currentPath", pathUrl);
});
现在需要知道如何使用保存的cookie制作每个,并显示表格。
答案 0 :(得分:0)
我不清楚这个想法,也许你可以这样试试
<table id="test-table">
<tr>
<td class="location"><a href="#location1">cookie saved 1</a>
</td>
<td class="location"><a href="#location2">cookie saved 2</a>
</td>
<td class="location"><a href="#location3">cookie saved 3</a>
</td>
</tr>
</table>
JS
$("table#test-table").find('tr').each(function() { });