Is and is in jquery (": Hidden") "Reprint"

Source: Internet
Author: User

When the book to Time to hate less, it is really so, long been in the use of jquery, but not a lot of time, the general use of a few properties and events. What you need when you use it is also found on the Internet. In the future, read more manuals, more things ... It's not so painful when it's used up. Today with IS and hidden, to share the next, by the way you also deepen the impression.

The following information is from the manual:

: HiddenMatches all invisible elements, and the INPUT element's type attribute is "hidden", which is also matched toreturn value

Array<element>

Example

Find all non-visible TR elements

HTML Code:

<table>
<tr style= "Display:none" ><td>value 1</td></tr>
<tr><td>value 2</td></tr>
</table>

JQuery Code:

$ ("Tr:hidden")

Results:

[<tr style= "Display:none" ><td>value 1</td></tr>]

is (expr)An expression is used to examine the currently selected collection of elements, and returns true if at least one of the elements conforms to the given expression. Returns ' false ' if no element is met, or if the expression is not valid. The function is actually called inside ' filter ', so the original rule of the filter () function is also applied here. Checks the current selection against a expression and returns true if at least one element of the selection fits the GIV En expression. If no element fits, or the expression is not valid and then the response would be ' false '. ' Filter ' is used internally, therefore all rules, the apply there apply here, as well.return value

Boolean

Parameters

Expr (String): An expression for filtering

Example

Returns true because the INPUT element's parent element is a FORM element.

HTML Code:

<form><input type= "checkbox"/></form>

JQuery Code:

$ ("input[type= ' checkbox ']"). Parent (). is ("form")

Results:

True

Instance:

JavaScript code

<script language="javascript" src="jquery.js" ></script>

<script>

JQuery (function ($) {

$ (". abc"). Click (function () {

if ($ (this). Next (". Content"), is (": Hidden")) {

$ (this). Next (". Content"). FadeIn ("slow");

$ (this). html ("close");

$ (this). addclass ("Closemore");

} Else {

$ (this). Next (". Content"). FadeOut ("slow");

$ (this). HTML ("open");

$ (this). addclass ("Closemore");

}

})

})

</script>

xml/html Code

<div>

<span class="abc"> Open </span>

<div class="content" style="Display:none;" >

Div_1 Content

</div>

</div>

<div>

<span class="abc"> Open </span>

<div class="content" style="Display:none;" >

Div_2 Content

</div>

</Div>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.