I am trying to select all those li under a div having className ui-menu like having UL as their child element.

有帮助吗?

解决方案

Try to use :has

$('div.ui-menu li:has(ul)')

其他提示

You can use the :has() selector.

In case you meant that the div is the one to have the .ui-menu class use this:

$('div.ui-menu li:has(ul)')

In case you meant that the li is the one to have the .ui-menu class use this:

$('div li.ui-menu:has(ul)')

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top