我正在使用 jQuerydata()
函数将数据存储在一系列 div 中,格式类似于:
{
options: {
example: {
option_1: {
value: "example 1"
},
option_2: {
value: "example 2"
}
}
}
}
我可以添加新密钥并更新数据,例如
$("#mydiv").data('options',{'example':{} }); // the object is already created in the live version
$("#mydiv").data('options')['example']['option_3'] = { value: "example 3" };
但是当我开始使用 removeData() 时,FireBug 告诉我密钥未定义,例如
$("#mydiv").removeData('options')['example']['option_2'];
任何帮助表示赞赏!