这种if
情况给我带来了麻烦:
if (div id=myfav has children) {
do something
} else {
do something else
}
我尝试了以下所有方法:
if ( $('#myfav:hasChildren') ) { do something }
if ( $('#myfav').children() ) { do something }
if ( $('#myfav:empty') ) { do something }
if ( $('#myfav:not(:has(*))') ) { do something }