Read from values from hidden field values in Jquery?

Posted by James123 on Stack Overflow See other posts from Stack Overflow or by James123
Published on 2010-05-08T19:26:55Z Indexed on 2010/05/08 19:38 UTC
Read the original article Hit count: 171

Last two nights I am struggle with below code. The problem is I need to remember expanded (or) collapsed toggles sections and on page reload I have show them as is expanded (or) collapsed.

$(function() {        
        $('tr.subCategory')            
        .css("cursor", "pointer")
        .attr("title", "Click to expand/collapse")
        .click(function() {        
               $(this).siblings('.RegText').toggle();            
     });
     $('tr[@class^=RegText]').hide().children('td');    
})

I found small solution in another forum like this. Storing ".subCategory" id values in hidden field in commas-seperated values.

In Asp.net page:
<input id="myVisibleRows" type="hidden" value="<% response.write(myVisibleRowsSavedValue) %" />  

In .js:
var idsStr = $(#myVisibleRows).val();

Now My question is: How to store multiple values (.subCategory id) in hidden field when I click on toggle?. also How to parse them back and iterate them get ids and show toggles?. I am very very new to jQuery. Please some one help me out from this.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about ASP.NET