jQuery UI | show() Method
Last Updated :
12 Jul, 2025
The
show() method of jQuery UI framework displays or manages all types of visual effects for the matched selected elements whose styles are designed in the CSS code for the user interface.
Syntax:
(selector).show( effectType[, options ] [, duration ] [, complete ] );
Parameters: It accepts a parameter “effectType” which is the type of the visual effect that are going to be added.
- effectType: The type is string. It specifies the type of the effect which is used for the transition.
- options: The type is object . It specifies the options required for the specific setting for easing.
- duration: The types are number or string . This specifies about, how long the animation effect should run for example fast, slow or 400ms
- complete: This is the callback method which is called when the animation effect is completed.
Return Value: It returns the selected elements with the given visual effect.
Links for jQuery UI:
<link
href=”https://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css”rel=&%238221;stylesheet&%238221;type=&%238221;text/css&%238221;/>
<script src=”https://code.jquery.com/jquery-1.10.2.js”></script>
<script src=”https://code.jquery.com/ui/1.10.4/jquery-ui.js”></script>
Example 1: In the following example, the
show() function is implemented in jQuery code with
shake effect type and
time and
distance as its options, and one callback function as its parameters which displays the visual effect for the matched elements. The callback function is called after the effect is completed or done on the screen. The callback function fades out the container after the completion of the effect during the process.
html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content=
"width=device-width, initial-scale=1">
<title>jQuery UI show() method</title>
<link href=
"https://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css"
rel="stylesheet">
<script src=
"https://code.jquery.com/jquery-1.10.2.js">
</script>
<script src=
"https://code.jquery.com/ui/1.10.4/jquery-ui.js">
</script>
<style>
.height {
height: 10px;
}
.divClass {
width: 400px;
height: 180px;
}
#btnID {
padding: .5em 1em;
text-decoration: none;
}
#container {
position: relative;
width: 260px;
height: 145px;
padding: 0.3em;
border: 1px solid black
}
</style>
<script>
$(function () {
function showEffect() {
// Run the show method with shake effect
$("#container").show("shake", { times: 10,
distance: 200 }, 2000, callback);
};
// Callback method
function callback() {
setTimeout(function () {
$("#container:visible")
.removeAttr("style").fadeOut();
}, 2000);
};
$("#btnID").click(function () {
showEffect();
return false;
});
$("#container").hide();
});
</script>
</head>
<body>
<h1 style="color:green">GeeksforGeeks</h1>
<b>jQuery UI show method </b>
<div class="height"></div>
<div class="divClass">
<div id="container">
<p>
This is jQuery UI show method demonstration,
which displays the matched elements.The
matched element will show the element with
the chosen effect in the jQuery code.
</p>
</div>
</div>
<div class="height"></div>
<button id="btnID">Show effect</button>
</body>
</html>
Output:
Example 2: In the following example, the simple implementation of
show() method is done in jQuery code with the
bounce visual effect as its parameter. The method is applied on "h2" element of the user interface page.
ui-corner-all and
ui-state-default are the in-built classes provided by the jQuery UI CSS framework to make the UI more interactive and beautiful.
html
<!DOCTYPE html>
<html>
<head>
<title>
jQuery UI Show Method with bounce effect
</title>
<meta name="viewport" content=
"width=device-width, initial-scale=1">
<link href=
"https://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css"
rel="stylesheet">
<script src=
"http://code.jquery.com/jquery-2.1.3.js">
</script>
<script src=
"http://code.jquery.com/ui/1.11.2/jquery-ui.js">
</script>
<style>
#btnID {
padding: .4em 1.5em;
text-decoration: none;
}
.highlight {
color: #090;
font-family: Calibri;
font-size: 2em;
text-shadow: 2px 2px #FF0000;
}
.height {
height: 10px;
}
</style>
<script>
$(document).ready(function () {
$("h2").hide();
$("#btnID").click(function () {
// Show with bounce effect
$("h2").show("bounce", 3000);
})
});
</script>
</head>
<body>
<h1 style="color:green">GeeksforGeeks</h1>
<b>jQuery UI show method with bounce effect</b>
<div class="height"></div>
<h2 class="highlight">Learning jQuery UI </h2>
<button id="btnID"
class="ui-corner-all ui-state-default">
Show effect
</button>
</body>
</html>
Output:
Example 3: The jQuery UI framework provides
show() method with many varieties of visual effects as its parameter. In the following example, we will demonstrate the method with a combobox menu option to select a visual effect type by the user. When the effect type is selected by the user, it is passed to
show() method for the output, as shown in the output image. The programmer can write the code and choose parameters as per the project requirement.
html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,
initial-scale=1">
<title>jQuery UI Show Method with All effects</title>
<link href=
"https://code.jquery.com/ui/1.10.4/themes/ui-lightness/jquery-ui.css"
rel="stylesheet">
<script src=
"http://code.jquery.com/jquery-2.1.3.js">
</script>
<script src=
"http://code.jquery.com/ui/1.11.2/jquery-ui.js">
</script>
<style>
.height {
height: 10px;
}
.divClass {
width: 500px;
height: 200px;
}
#btnID {
padding: .4em 1em;
text-decoration: none;
}
#container {
width: 250px;
height: 180px;
padding: 0.5em;
position: relative;
}
#container h4 {
margin: 0;
padding: 0.3em;
text-align: center;
}
</style>
<script>
$(function () {
// show the selected effect
// type by the user
function showEffect() {
var effectType = $("#typesOfEffectId").val();
// show the effect with call back
$("#container").show(effectType, 800, callback);
};
// Callback function to get original state
function callback() {
setTimeout(function () {
$("#container:visible")
.removeAttr("style").fadeOut();
}, 2000);
};
// Set effect from select menu value
$("#btnID").on("click", function () {
showEffect();
});
$("#container").hide();
});
</script>
</head>
<body>
<h1 style="color:green">GeeksforGeeks</h1>
<b>jQuery UI show method with all type of effects</b>
<div class="height"></div>
<div class="divClass">
<div id="container" class="ui-widget-content ui-corner-all">
<h4 class="ui-widget-header ui-corner-all">Show</h4>
<p>
In this tutorial, we are going to learn about
jQuery UI framework show method with different
variety of effects.
</p>
</div>
</div>
<select name="effectTypes" id="typesOfEffectId">
<option value="blind">Blind</option>
<option value="clip">Clip</option>
<option value="drop">Drop</option>
<option value="explode">Explode</option>
<option value="fade">Fade</option>
<option value="fold">Fold</option>
<option value="highlight">Highlight</option>
<option value="puff">Puff</option>
<option value="pulsate">Pulsate</option>
<option value="slide">Slide</option>
</select>
<button id="btnID" class="ui-state-default ui-corner-all">
show Effect
</button>
</body>
</html>
Output:
Similar Reads
jQuery Tutorial jQuery is a lightweight JavaScript library that simplifies the HTML DOM manipulating, event handling, and creating dynamic web experiences. The main purpose of jQuery is to simplify the usage of JavaScript on websites. jQuery achieves this by providing concise, single-line methods for complex JavaSc
8 min read
Getting Started with jQuery jQuery is a fast lightweight, and feature-rich JavaScript library that simplifies many common tasks in web development. It was created by John Resign and first released in 2006. It makes it easier to manipulate HTML documents, handle events, create animations, and interact with DOM(Document Object M
4 min read
jQuery Introduction jQuery is an open-source JavaScript library that simplifies the interactions between an HTML/CSS document, or more precisely the Document Object Model (DOM). jQuery simplifies HTML document traversing and manipulation, browser event handling, DOM animations, Ajax interactions, and cross-browser Java
7 min read
jQuery Syntax The jQuery syntax is essential for leveraging its full potential in your web projects. It is used to select elements in HTML and perform actions on those elements.jQuery Syntax$(selector).action()Where - $ - It the the shorthand for jQuery function.(selector) - It defines the HTML element that you w
2 min read
jQuery CDN A Content Delivery Network (CDN) is a system of distributed servers that deliver web content to users based on their geographic location. Including the jQuery CDN in your project can improve the performance, enhance reliability, and simplify maintenance.What is a jQuery CDN?A jQuery CDN is a service
4 min read
jQuery Selectors
JQuery SelectorsWhat is a jQuery Selector?jQuery selectors are functions that allow you to target and select HTML elements in the DOM based on element names, IDs, classes, attributes, and more, facilitating manipulation and interaction. Syntax: $(" ")Note: jQuery selector starts with the dollar sign $, and you encl
5 min read
jQuery * SelectorThe jQuery * selector selects all the elements in the document, including HTML, body, and head. If the * selector is used together with another element then it selects all child elements within the element used. Syntax: $("*")Parameters: *: This parameter is used to select all elements.Example 1: Se
1 min read
jQuery #id SelectorjQuery is an open-source JavaScript library that simplifies the interactions between an HTML/CSS document, or more precisely the Document Object Model (DOM), and JavaScript. Elaborating on the terms, it simplifies HTML document traversing and manipulation, browser event handling, DOM animations, Aja
1 min read
jQuery .class SelectorThe jQuery .class selector specifies the class for an element to be selected. It should not begin with a number. It gives styling to several HTML elements. Syntax: $(".class") Parameter: class: This parameter is required to specify the class of the elements to be selected.Example 1: In this example,
1 min read
jQuery Events
jQuery Effects
jQuery HTML/CSS
jQuery Traversing