当前位置: 动力学知识库 > 问答 > 编程问答 >

javascript - How to live check that element is empty with jQuery

问题描述:

This question already has an answer here:

  • jquery does div contain children of a certain class

    2 answers

网友答案:

try if($(this).children('span').length==0)

网友答案:
if ($(this).is(':empty')) {...}

or:

if (!$(this).has('span')) {...}

or just:

if (!$(this).children().length) {...}
分享给朋友:
您可能感兴趣的文章:
随机阅读: