【发布时间】:2010-05-08 19:26:55
【问题描述】:
过去两个晚上我都在为下面的代码而苦恼。问题是我需要记住展开(或)折叠的切换部分,并且在页面重新加载时我已经将它们显示为展开(或)折叠。
$(function() {
$('tr.subCategory')
.css("cursor", "pointer")
.attr("title", "Click to expand/collapse")
.click(function() {
$(this).siblings('.RegText').toggle();
});
$('tr[@class^=RegText]').hide().children('td');
})
我在另一个类似的论坛中找到了小解决方案。以逗号分隔值在隐藏字段中存储“.subCategory”id 值。
In Asp.net page:
<input id="myVisibleRows" type="hidden" value="<% response.write(myVisibleRowsSavedValue) %" />
In .js:
var idsStr = $(#myVisibleRows).val();
现在我的问题是:当我点击切换时,如何在隐藏字段中存储多个值(.subCategory id)?。还如何将它们解析回来并迭代它们获取 id 并显示切换?。我对 jQuery 非常陌生。请有人帮我解决这个问题。
【问题讨论】:
标签: asp.net javascript jquery hidden-field