Home  >  Article  >  Web Front-end  >  jQuery shows and hides commonly used status judgment methods_jquery

jQuery shows and hides commonly used status judgment methods_jquery

WBOY
WBOYOriginal
2016-05-16 16:17:081126browse

Display: show() display:block;

Hide: hide() display:none;

When switching between display and hiding, you need to determine whether it is displayed or hidden at the moment. The following methods are commonly used to determine the conditions:

1.if(thisNode.is(':hidden')){......}else{.....}

2. First add a class identifier to the Dom element of thisNode, for example, change the identifier to class="showFlag", the judgment is as follows

if(thisNode.hasClass('showFlag')){.....}else{......}

In the same way, you can also judge other contents of thisNode, such as the number of sub-elements, text content, etc., based on specific needs.

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