title: set active accordion in Jquery
body: <p>I am using MVC with C# also with jquery.</p>
  
  <p>I am using an jquery accordion to see the list of employee details.
  On clicking an accordion it'll show the employee details.</p>
  
  <p>When I click Edit of an Employee, it takes to the Employee details page and after save it'll have the EmployeeDetailsID in session. When I come back to the accordion page, the accordion with the last updated employee should be open by default (i.e. Accordion should be open based on the EmployeeDetailsID in session).</p>
  
  <p>Please suggest how to do this.</p>
  
  <p>Below is the code for reference.</p>
  
  <pre><code>&lt;html&gt;
  &lt;body&gt;
  &lt;div class="accordion" id="accordion"&gt;
      &lt;%if (Model != null &amp;&amp; Model.EmployeeList != null &amp;&amp; Model.EmployeeList.Count &gt; 0)
                {
                    foreach (EmployeeDetails _employee in Model.EmployeeList)
                    {
      %&gt;
      &lt;h3&gt;
          &lt;div class="heading_acc"&gt;
              &lt;a href="#" onclick="javascript:ShowEmployees(&lt;%= _employee.EmployeeDetailsID %&gt;);"
                  id="aEmployee"&gt;&lt;b&gt;&lt;span class="dash_title_bar_right"&gt;
                      &lt;%=Html.Encode(_employee.EmployeeName)%&gt;&lt;/b&gt; &lt;/a&gt;
          &lt;/div&gt;
      &lt;/h3&gt;
      &lt;div&gt;
          &lt;div id="divReturns&lt;%= _employee.EmployeeDetailsID %&gt;"&gt;
              &lt;table width="100%" class="list_contentregion"&gt;
                  &lt;tr&gt;
  
                      &lt;th class="dash_table_head"&gt;
                          Name
                      &lt;/th&gt;
                      &lt;th class="dash_table_head"&gt;
                          Role
                      &lt;/th&gt;
                      &lt;th class="dash_table_head"&gt;
                          Branch
                      &lt;/th&gt;
                      &lt;th class="dash_table_head"&gt;
                          Last Updated
                      &lt;/th&gt;
                  &lt;/tr&gt;
                  &lt;tr id="trEmp&lt;%= _employee.EmployeeDetailsID %&gt;" class="dash_label"&gt;
  
                      &lt;td&gt;
                          &lt;div id="lblName&lt;%= _employee.EmployeeDetailsID %&gt;"&gt;
                          &lt;/div&gt;
                      &lt;/td&gt;
                      &lt;td&gt;
                          &lt;div id="lblRole&lt;%= _employee.EmployeeDetailsID %&gt;"&gt;
                          &lt;/div&gt;
                      &lt;/td&gt;
                      &lt;td&gt;
                          &lt;div id="lblBranch&lt;%= _employee.EmployeeDetailsID %&gt;"&gt;
                          &lt;/div&gt;
                      &lt;/td&gt;
                      &lt;td&gt;
                          &lt;div id="lblTime&lt;%= _employee.EmployeeDetailsID %&gt;"&gt;
                          &lt;/div&gt;
                      &lt;/td&gt;
                  &lt;/tr&gt;
              &lt;/table&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;%}
                } %&gt;
  &lt;/div&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>