title: jQuery Accordion setting active
body: <p>I have a jQuery accordion in a page in ASP:Net MVC application in which I want to set the active accordion at runtime.</p>
  
  <p>My code is as follows:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      $(document).ready(function() {
          var accordionindex = $("#UIPViewModel_ActiveAccordion").val();
          alert("Setting active index to " + accordionindex);
          $("#accordion").accordion('activate', accordionindex );
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>You will see the last line sets the active accordion. <strong>When I use this code</strong> it always acts like I have used active : false and <strong>ALL of the accordions are closed</strong> even though the alert displays the correct runtime value.</p>
  
  <p>I have also tried simply using the following which is the same:</p>
  
  <p>$("#accordion").accordion('activate', $("#UIPViewModel_ActiveAccordion").val());</p>
  
  <p>When I change the last line to :</p>
  
  <p>$("#accordion").accordion('activate', 2 ); (i.e. hard-coded). It always works correctly!</p>
  
  <p>Can anyone see what´s wrong?
  Where i am making my mistake??</p>