I have html like this
<h2 class="Comprehensive Leadership">Comprehensive Leadership</h2><a href="/topic/comprehensiveleadership">View all Comprehensive Leadership Programs </a>
<br><a href="/programs/pld/Pages/default.aspx" class="Comprehensive Leadership">Program for Leadership Development ></a><br>Dec 2011–Jun 2012<br><a href="/programs/gmp/Pages/default.aspx" class="Comprehensive Leadership">General Management Program ></a><br>Jan–May 2012<br>
<h2 class="Corporate Governance">Corporate Governance</h2><a href="/topic/corporategovernance">
View all Corporate Governance Programs </a><br><a href="/programs/ac/Pages/default.aspx" class="Corporate Governance">Audit Committees in a New Era of Governance ></a><br>Nov 13–15, 2011<br><a href="/programs/cc/Pages/default.aspx" class="Corporate Governance">Compensation Committees ></a><br>Nov 16–18, 2011<br>
<div class="tabbed-content"><ul class="tabs"><li><ul><li><a href="#" class="Comprehensive Leadership">Comprehensive Leadership</a></li><li><a href="#" class="Corporate Governance">Corporate Governance</a></li><div>
If I click Comprehensive Leadership it should only display first h2 tag by matching the class till next h2 tag, that is :
<h2 class="Comprehensive Leadership">Comprehensive Leadership</h2><a href="/topic/comprehensiveleadership">View all Comprehensive Leadership Programs </a>
<br><a href="/programs/pld/Pages/default.aspx" class="Comprehensive Leadership">Program for Leadership Development ></a><br>Dec 2011–Jun 2012<br><a href="/programs/gmp/Pages/default.aspx" class="Comprehensive Leadership">General Management Program ></a><br>Jan–May 2012<br>
I can change the html little bit…i have also paste it here : http://jsfiddle.net/sMCsw/10/
A better solution would be not to select by class, but by the actual value of the H2 using this: