# Accordion how to open particular header using script

**URL:** https://forum.kirupa.com/t/accordion-how-to-open-particular-header-using-script/327912
**Category:** web dev
**Created:** [April 5, 2012, 5:12am UTC](https://forum.kirupa.com/t/accordion-how-to-open-particular-header-using-script/327912 "2012-04-05T05:12:23Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![nitinmukesh](https://avatars.discourse-cdn.com/v4/letter/n/7feea3/32.png) [@nitinmukesh](https://forum.kirupa.com/u/nitinmukesh)
#### Post date: [April 5, 2012, 5:12am UTC](https://forum.kirupa.com/t/accordion-how-to-open-particular-header-using-script/327912/1 "2012-04-05T05:12:23Z")

</div>

Hi,

I have created a accordion menu using the following code

> 

```
 [LEFT] [COLOR=#000000] [COLOR=#007700]&lt;[/COLOR][COLOR=#0000BB]h3[/COLOR][COLOR=#007700]&gt;[/COLOR][COLOR=#0000BB]Level 1[/COLOR][COLOR=#007700]&lt;/[/COLOR][COLOR=#0000BB]h3[/COLOR][COLOR=#007700]&gt; 

```

\<[/COLOR][COLOR=#0000BB]div[/COLOR][COLOR=#007700]\>[/COLOR][COLOR=#0000BB]Content[/COLOR][COLOR=#007700]\</[/COLOR][COLOR=#0000BB]div[/COLOR][COLOR=#007700]\>  
\<[/COLOR][COLOR=#0000BB]h3[/COLOR][COLOR=#007700]\>[/COLOR][COLOR=#0000BB]Level 2[/COLOR][COLOR=#007700]\</[/COLOR][COLOR=#0000BB]h3[/COLOR][COLOR=#007700]\>  
\<[/COLOR][COLOR=#0000BB]div[/COLOR][COLOR=#007700]\>[/COLOR][COLOR=#0000BB]Content[/COLOR][COLOR=#007700]\</[/COLOR][COLOR=#0000BB]div[/COLOR][COLOR=#007700]\>  
\<[/COLOR][COLOR=#0000BB]h3[/COLOR][COLOR=#007700]\>[/COLOR][COLOR=#0000BB]Level 3[/COLOR][COLOR=#007700]\</[/COLOR][COLOR=#0000BB]h3[/COLOR][COLOR=#007700]\>  
\<[/COLOR][COLOR=#0000BB]div[/COLOR][COLOR=#007700]\>[/COLOR][COLOR=#0000BB]Content[/COLOR][COLOR=#007700]\</[/COLOR][COLOR=#0000BB]div[/COLOR][COLOR=#007700]\>  
[/COLOR] [/COLOR]  
[/LEFT]

I want to open the different level headers using code. I tried looking into accordion and widgets code but could not find anything.

Please help me what code should be used to open a particular header. Also how to find if the head which should open is already open or not.

I also tried using  
$(“#rightMenuAccordion”).activate(‘activate’,1)

as listed here but it says it does not exist

> **[Accordion | jQuery UI](https://jqueryui.com/accordion/)**
>
> jQuery UI is a curated set of user interface interactions, effects, widgets, and themes built on top of the jQuery JavaScript Library. Whether you're building highly interactive web applications or you just need to add a date picker to a form...

[EDIT]  
Finally found the solution  
$(“#rightMenuAccordion”).accordion(‘activate’, 2);
