new class? or parent?

new class? or parent?

Hi,

Looking for some pointers on how to access a subset of a class.

The html comprises many divs with the same structure:

<div class="h">
<p class="b1">text...</p>
<p class="a2">more text...</p>
<p class="b3">text text text...</p>
<p class="a4">text etc etc</p>/div>

Depending on the class of p (either 'a' or 'b', plus an integer), the parent div will have a style change, or an animation run. 

In javascript, you'd reach the parent divs like this:

function changeH(abN) {
for (i=0; i<elP.length; i++) {
if(abN == elP[i].className) { 
elP[i].parentNode.style.whateverSelector = "newValue";}
 }}
called with, eg, changeH('b2').

But I'm not clear how you do this with jQuery: would you create a new class for the subset of div.h ? or use 'parent' ?