title: How do I get the index of a JQuery Accordion from the header row ID?
body: <p>I've got an Accordion and I want to get the index of a particular header by its ID.</p>
  
  <p>The accordion is generated from a repeater:</p>
  
  <pre><code>&lt;asp:Repeater ID="rptProjectList" OnItemDataBound="rptProjects_ItemDataBound" runat="server"&gt;
      &lt;HeaderTemplate&gt;
          &lt;div id="accordion"&gt;
      &lt;/HeaderTemplate&gt;
  
      &lt;ItemTemplate&gt;
          &lt;h1 style="margin: 0px" class="accordionHeader" id='&lt;%# Eval("projectCode") %&gt;'&gt;&lt;/h1&gt;
  
          &lt;div&gt;
             ....some stuff             
          &lt;/div&gt;
      &lt;/ItemTemplate&gt;
  
      &lt;FooterTemplate&gt;
          &lt;/div&gt;
      &lt;/FooterTemplate&gt;
  &lt;/asp:Repeater&gt;
  </code></pre>
  
  <p>I want to be able to open the page with a particular section expanded, given the projectCode as a parameter. e.g. user goes to MyPage.aspx?project=ABC123 and the page loads with the ABC123 project open and the other panels collapsed.</p>
  
  <p>The jQuery I have is:</p>
  
  <pre><code>var activeProject = $(document).getUrlParam("project");
  </code></pre>
  
  <p>which gets the code.</p>
  
  <p>And</p>
  
  <pre><code>$j('#accordion').accordion({
          active: activeIndex,
          collapsible: true
      });
  </code></pre>
  
  <p>which sets the Accordion.</p>
  
  <p>The bit I can't figure out is the bit in the middle. I need to be able to get the activeIndex by iterating over the div to get the index of the row with the relevant project code. </p>