show method in jQuery with examples

1. show() method is used to show the elements.
2. show() with no duration is equivalent to css property 'display : inline'.
3. show(200) with duration specified becomes animation method.
4. Duration is given in milliseconds, and slow and fast string indicates 600 and 200 milliseconds respectively.

Example 1 :

        <title>show in jQuery</title>
        <script type="text/javascript" src=""> 
        <script type="text/javascript">
            $(document).ready(function () {
                $("#buttonHide").click(function () {

                $("#buttonShowNormal").click(function () {

                $("#buttonShowAnimation").click(function () {
                    $("#form").show("slow", function () {
                        alert("Show Animated !!");
        <fieldset id="form">
        <td><input type="text" id="txtName"><td>
        <td><input type="text" id="txtAge"><td>
        <td><input type="text" id="txtAddress"><td>
        <div id="buttonDiv">
        <input type="button" id="buttonHide" value="Hide"/>
        <input type="button" id="buttonShowNormal" value="Show Normal"/>
        <input type="button" id="buttonShowAnimation" value="Show Animation"/>
Demo :

In the above example, we have used show() method. When we click the "ShowNormal" button, it will show the form quickly like changing the display property from none to inline without animation involved.
        There is no animation involved, as we have not specified duration. When we click on "ShowAnimation" button, It shows the form with animation effect as duration for show() method is specified.


Post a Comment