I have the following HTML (a snippet):
<td class="ms-vb-title" height="100%">
<table class="ms-unselectedtitle" onmouseover="OnItem(this)"
ctxname="ctx1" id="5" url=
"/Business%20Divisions/5_.000" dref=
"/Business Divisions" perm="0x7fffffffffffffff"
type="" ext="" icon="icgen.gif||" otype="0" couid="" hcd=""
csrc="" ms="0" ctype="Item" cid=
"0x010072628A3517FD5F4A8D399BADE8A6D104" uis="512" surl="">
<tbody>
<tr>
<td class="ms-vb" width="100%"><a onfocus="OnLink(this)"
href=
"/Business%20Divisions/DispForm.aspx?ID=5"
onclick="GoToLink(this);return false;" target=
"_self">Commercial</a></td>
</tr>
</tbody>
</table>
</td>
</tr>
Now I want to get the ID of tables with class .ms-unselectedtitle and store them in an array. I do this with:
var businessUnitID = new Array();
$('.ms-unselectedtitle').each(function(){
businessUnitID.push($(this).attr('id'));
the class .ms-unselectedtitle is used in a lot of other places in the html though so I wonder if there’s a way to get all IDs of tables with class .ms-unselectedtitle and that has a parent td with class .ms-vb-title? Or get all ID’s of a td, with class .ms-vb-title, table (with class ..ms-unselectedtitle) children?
Thanks in advance.
You can try this, to get all IDs of tables with class
.ms-unselectedtitle(and parent TD with class.ms-vb-title):Try it here: http://jsfiddle.net/Nt7zv/