这个 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 }