hey guys, if a "ul" has more than one "li"-element inside of it, somehting should happen, otherwise not! what am I doing wrong?
if ( $('#menu ul').length > 1 ) {
regards matt
hey guys, if a "ul" has more than one "li"-element inside of it, somehting should happen, otherwise not! what am I doing wrong?
if ( $('#menu ul').length > 1 ) {
regards matt
You have to count the li elements not the ul elements:
if ( $('#menu ul li').length > 1 ) {
If you need every UL element containing at least two LI elements, use the filter function:
$('#menu ul').filter(function(){ return $(this).children("li").length > 1 })
You can also use that in your condition:
if ( $('#menu ul').filter(function(){ return $(this).children("li").length > 1 }).length) {