Home > Web Front-end > JS Tutorial > body text

Summary of JQuery's methods for displaying hidden page elements_jquery

WBOY
Release: 2016-05-16 16:03:42
Original
1577 people have browsed it

There are many ways to show and hide divs in jquery, such as the relatively simple functions show(), hide(), toggle(), slideDown() and css to set the style attribute of the div. Below I to introduce.

show() method

Show hidden

elements.

Copy code The code is as follows:

$(".btn2").click(function(){
$("p").show();
});

toggle() method The

toggle() method switches the visible state of an element.
Hide the selected elements if they are visible, and show them if the selected elements are hidden.

Copy code The code is as follows:







This is a paragraph.





slideDown() method

Swipe to show hidden

elements:

Copy code The code is as follows:

$(".btn2").click(function(){
$("p").slideDown();
});

hide() method

Hide visible

elements:

Copy code The code is as follows:

$(".btn1").click(function(){
$("p").hide();
});

This function is often used together with show

css() method

The

css() method sets or returns one or more style attributes of the selected element.

Return CSS properties
To return the value of a specified CSS property, use the following syntax:

Copy code The code is as follows:

css("propertyname");
$("p").css("display","none");

Take a look at an example
Copy code The code is as follows:









Show and hide special effects for content in div










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