Here is the structure of the HTML
<div class="submenu">
<ul>
<li></li>
<li></li>
</ul>
<ul>
<li></li>
<li></li>
</ul>
<ul>
<li></li>
<li></li>
</ul>
</div>
If there are three UL the the I want to add three-col class.
two UL then two-col
Using Jquery,
$(".submenu > ul").size()gives you the count.This will set the class on the div with class submenu: