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

jQuery shows and hides commonly used status judgment methods_jquery

WBOY
Release: 2016-05-16 16:17:08
Original
1200 people have browsed it

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.

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template