open closest ul on click jQuery
问题 when clicking a.market-metro, open closest ul.children. <ul class="drop-padding"> <li> <a class="market-metro">text</a> <ul class="children">...</ul> </li> <li> <a class="market-metro">text</a> <ul class="children">...</ul> </li> <li> <a class="market-metro">text</a> <ul class="children">...</ul> </li> I have the following but not working: jQuery(".market-metro").click(function(){ if (jQuery(".market-metro").closest('li').find('ul.children').hasClass("expanded")) { jQuery(".market-metro")