我认为我在我的网页设计中有一个重大的错误。如果我重新启动计算机或关闭网页,我需要保存内容。保存到localstorage动态JQuery行
我没有访问任何类型的数据库服务器只有MS Access。我正在考虑利用本地存储,因为该页面将不断从同一台计算机上查看。
我发现这个例子[link] Edit functionality using javascript and local storage但是我不确定它是否会工作。
有人可以看我的例子,让我知道如果我可以做到这一点,或者如果我需要放弃这一点,并重新开始。
$(document).ready(function() {
var id = 0;
// Add button functionality
$("table.dynatable button.add").click(function() {
id++;
var master = $(this).parents("table.dynatable");
// Get a new row based on the prototype row
var prot = master.find(".prototype").clone(true);
prot.attr("class", "")
prot.find(".id").attr("value", id);
master.find("tbody").append(prot);
});
// Remove button functionality
$(document).on("click", "table.dynatable button.remove", function() {
$(this).parents("tr").remove();
});
});
http://jsfiddle.net/deaconf19/csL68/
感谢
此代码似乎与保存任何数据没有任何关系,只需添加和删除表格行即可。你的数据处理在哪里? – Eamonn
你在本地运行网络服务器吗? –
我正在使用SharePoint进行托管。目前没有任何东西被保存,但我需要保存将要输入到这些字段中的数据。此外,我无权访问SQL服务器或中央管理员 – JeremyA1