Here I am discussing the top ten functions of jQuery.
- hide() function
- show() function
- toggle() function
- slideUp() function
- slideDown() function
- slideToggle() function
- fadeOut() function
- fadeIn() function
- fadeToggle()
- animate() function
Now I'll explain the topic.
- Hide function
It is used to hide the selected html element in a simple way. As a name it only works in hidden selected element. In jQuery the Hide () method is very useful. By using this method you can hide HTML elements with the hide().
This example, we have created a hide function to hide the selected element. I have created three div tags for this purpose.- <script>
- // We have to use hide function to hide the element as well.
- $(‘#hide_jQuery’).click(function(){
- $(‘# jQuery’).hide();
- });
- $(‘#show_ jQuery’).click(function(){
- $(‘# jQuery’).show();
- });
- </script>
- <div id=”hide_ jQuery”></div>
- <div id=”show_ jQuery”></div>
- <div id=” jQuery”></div>
Below is the First one, the div tag where we have to click for hiding the jQuery.- <div id=”hide_ jQuery”></div>
- Show function
It is used to show the selected html element. We can say that these functions work in the opposite in hide function. But before calling this function it must use the hide function on the same element
Example
- <script>
- // We have to use hide function to hide the element as well.
- $(‘#hide_ jQuery’).click(function(){
- $(‘# jQuery’).hide();
- });
- $(‘#show_ jQuery’).click(function(){
- $(‘# jQuery’).show();
- });
- </script>
- <div id=”hide_ jQuery”></div>
- <div id=”show_ jQuery”></div>
- <div id=” jQuery”></div>
- Toggle function
It is used to both (hide, show) functions to toggle between for the click event for the selected elements. It means this function is used to hide or show the specific selected element. A toggle functions well compared to hide and show function.
Example
For more details click on link.- <!doctype html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <title>toggle demo</title>
- <script src="https://code.jquery.com/jquery-1.10.2.js"></script>
- </head>
- <body>
- <button>Toggle</button>
- <div>Hello</div>
- <script>
- $("button").click(function()
- {
- $("div").toggle();
- });
- </script>
- </body>
- </html>
- SlideUp function
This function is used to slide and show element's up side. It slides the selected elements up and removes it slowly.
Example
For more details click on link.- <script type="text/javascript">
- $(document).ready(function ()
- {
- $("#btnSlideUp").click(function ()
- {
- $("#login_wrapper").slideUp();
- return false;
- });
- });
- </script>
- SlideDown function
This function is used to slide and hide an element on down side.
Example
For more details click on link.- <script type="text/javascript">
- $(document).ready(function ()
- {
- $("#btnSlideDown").click(function ()
- {
- $("#login_wrapper").slideDown();
- return false;
- });
- });
- </script>
- SlideToggle function
This method is between slideUp() method and slideDown() method. It shows/hides an element in up/down side.
Example
For more details click on link.- <script type="text/javascript">
- $(document).ready(function ()
- { $("#btnSlideToggle").click(function ()
- {
- $("#login_wrapper").slideToggle();
- return false;
- });
- });
- </script>
- FadeOut Function
The jQuery fadeOut() method fades out a visible element and hides it.
Syntax
$(selector).fadeOut(speed,callback);
Example
For more details click on link.- <script type="text/javascript">
- $(document).ready(function ()
- {
- $("#btnEffect").click(function ()
- {
- $("#panelPersonalInfo").fadeOut();
- $("#panelAddressInfo").fadeOut("slow");
- $("#panelLoginInfo").fadeOut(4000); //millisecond
- return false;
- });
- });
- </script>
- FadeIn function
The jQuery fadeIn() method displays a hidden element by fading it in.
The syntax is
$(selector).fadeIn(speed,callback);
Example
For more details click on link.- <script type="text/javascript">
- $(document).ready(function ()
- {
- $("#btnEffect").click(function ()
- {
- $("#panelPersonalInfo").fadeIn();
- $("#panelAddressInfo").fadeIn("slow");
- $("#panelLoginInfo").fadeIn(4000); //millisecond
- return false;
- });
- });
- </script>
- FadeToggle
The jQuery fadeToggle() method toggles between the fadeIn() and fadeOut() methods. If the page's elements are faded out then fadeToggle() will fade them in and if the elements are faded in then fadeToggle() will fade them out.
Example
For more details click on link.- <script type="text/javascript">
- $(document).ready(function ()
- {
- $("#btnEffect").click(function ()
- {
- $("#panelPersonalInfo").fadeToggle();
- $("#panelAddressInfo").fadeToggle("slow");
- $("#panelLoginInfo").fadeToggle(4000); //millisecond
- return false;
- });
- });
- </script>
- Animate function
In jQuery the animate() method is very useful. By using this method we can change the size of elements. In this example we create a div element which contains an Image; when we move the mouse over the image, the image size will change. First of all you add an image to the application. Add a new form to the application and add the following HTML code to the aspx page.
Example
Now add the following code in the head section.- <div style="height: 100px; width: 100px; position: relative">
- <img src="animate.gif" id="img" />
- </div>
In the above code we create a mouseover function.- <script type="text/javascript">
- $(document).ready(function () {
- $("div").mouseover(function ()//mouseover function will execute when mouse pointer will reach on <div>element
- {
- $("img").animate({ height: 300 }, "slow"); //image height will change by using animate method
- $("img").animate({ width: 300 }, "slow");
- $("img").animate({ height: 100 }, "slow");
- $("img").animate({ width: 100 }, "slow");
- });
- }
- );
- </script>
For more details click on link.- $("img").animate({ height: 300 }, "slow"); //image height will change by using animate method
- $("img").animate({ width: 300 }, "slow");
- $("img").animate({ height: 100 }, "slow");
- $("img").animate({ width: 100 }, "slow");

Rajeesh MenothPosted May 28, 2016, 3:37 AM
Thanks for sharing..
NitinPosted May 28, 2016, 2:22 AM
Good one
Munesh SharmaPosted May 27, 2016, 2:00 PM
nice
Sonu ChaudharyPosted May 27, 2016, 10:14 AM
nice share
Ravi PatelPosted May 27, 2016, 8:29 AM
nice explanation sir
Ajay MalikPosted May 27, 2016, 4:53 AM
nice sir....
Muhammad Aqib ShehzadPosted May 27, 2016, 12:51 AM
good share
Debasis SahaPosted May 26, 2016, 3:35 PM
Nice sharing..
Deeksha PanditPosted May 26, 2016, 3:34 PM
Thank you Sir
RakeshPosted May 26, 2016, 3:27 PM
Good share