Open jquery accordion with dynamically generated id using link on same page
I have the following accordions, below, on my page, however, I am looking for code that will work regardless how many accordions there are on the page.
My goal is to have links on the same page that open either of the accordions. I have yet to find javascript or jquery that will account for dynamically generated accordion id's.
Any help in pointing me in the right direction would be greatly appreciated. Thank you!
Peter T
- <div class="unit-100 accordion">
- <div id="1" data-tools="accordion" data-scroll="true">
- <h3>
- <a href="#1-accordion-link-one" name="panel-1" class="accordion-title" rel="#panel55928">
- Accordion Link One
- </a>
- <div id="1-accordion-link-one" class="accordion-panel content">
- <div class="units-row unit-100 end accordion">
- <p>Div accordion 1 content goes here...</p>
- </div>
- </div>
- </h3>
- </div>
- <div id="2" data-tools="accordion" data-scroll="true">
- <h3>
- <a href="#2-accordion-link-two" name="panel-2" class="accordion-title" rel="#panel55928">
- Accordion Link Two
- </a>
- <div id="2-accordion-link-two" class="accordion-panel content">
- <div class="units-row unit-100 end accordion">
- <p>Div accordion 2 content goes here...</p>
- </div>
- </div>
- </h3>
- </div>
- </div>