I have a jQuery accordion on a page in an ASP: Net MVC application in which I want to set an active accordion at runtime.
My code is as follows:
<script type="text/javascript">
$(document).ready(function() {
var accordionindex = $("#UIPViewModel_ActiveAccordion").val();
alert("Setting active index to " + accordionindex);
$("#accordion").accordion('activate', accordionindex );
});
</script>
You will see that the last line sets the active accordion. When I use this code , it always acts as if I used active: false and ALL accordions are closed , although the warning shows the correct runtime.
I also tried just using the exact same thing:
$ ("# accordion"). accordion ('activate', $ ("# UIPViewModel_ActiveAccordion"). val ());
When I change the last line to:
$( "# accordion" ). accordion ('activate', 2); (.. ). !
- , ?
?