1. Determine whether the text is empty
var jqObj = $( this);
if(jqObj.text().trim()){ //trim() method is to remove spaces, $.trim() function removes all line breaks and spaces (including non-breaking spaces) in the provided string ), start and end tab. If these whitespace characters occur in the middle of the string, they will be preserved.
jqObj.hide();
}
2. Determine whether there is a known element under this tag, such as determining whether there is a li element under the ul tag
var jqObj = $(this);
if(!jqObj. has('li').length){
jqObj.hide();
}
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn