Try this:

if ( $('ul', this).length ) {
  // do something if this li has a descendant ul
}



--Karl

____________
Karl Swedberg
www.englishrules.com
www.learningjquery.com




On Jun 27, 2009, at 8:31 AM, zayatzz wrote:


Hello

I have function like this:

$("ul.lavaLamp li:has ul").hoverIntent(function(){ ....

For various reasons i need to run other functions in this hoverintent
function, some functions need to be run for all lavalamp ul li's not
only those that have ul's. Therefore i have to run hoverintent like
this instead:

$("ul.lavaLamp li").hoverIntent(function()

But what is the shortest way to run certain functions on those li's
that have uls.

if  ($(this has:ul)) obviously does not work.. but is there a function
that checks if element has certain children? something i could use
like if ( $(this).has(element) )

Alan

Reply via email to