Author: saqibkhan

  • Traversing Descendants

    jQuery provides methods to traverse downwards inside the DOM tree to find descendant(s) of a given element. These methods can be used to find a child, grandchild, great-grandchild, and so on for a given element inside the DOM.

    There are following three methods to traverse downwards inside the DOM tree:

    • children() – returns all the direct children of the matched element.
    • find() – returns all the descendant elements of the matched element.

    The children() method differs from find() in that children() only travels a single level down the DOM tree where as find() method can traverse down multiple levels to select descendant elements (children, grandchildren, great-grandchildren etc.) as well.

    jQuery children() Method

    The jQuery children() method returns all the direct children of the matched element. Following is a simple syntax of the method:

    $(selector).children([filter])

    We can optionally provide a filter selector in the method. If the filter is supplied, the elements will be filtered by testing whether they match it.

    Synopsis

    Consider the following HTML content:

    <div class="great-grand-parent"><div class="grand-parent"><ul class="parent"><li class="child-one">Child One</li><li class="child-two">Child Two</li></ul></div><div class="grand-parent"><ul class="parent"><li class="child-three">Child Three</li><li class="child-four">Child Four</li></ul></div></div>

    Now if we use the children() method as follows:

    $(".great-grand-parent").children().css("border","2px solid red");

    It will produce following result:

    <div class="great-grand-parent"><div class="grand-parent" style="border:2px solid red"><ul class="parent"><li class="child-one">Child One</li><li class="child-two">Child Two</li></ul></div><div class="grand-parent" style="border:2px solid red"><ul class="parent"><li class="child-three">Child Three</li><li class="child-four">Child Four</li></ul></div></div>

    Example

    Let’s try the following example and verify the result:

    <!doctype html><html><head><title>The jQuery Example</title><script src="https://www.tutorialspoint.com/jquery/jquery-3.6.0.js"></script><script>$(document).ready(function(){$("button").click(function(){$(".great-grand-parent").children().css("border","2px solid red");});});</script><style>.great-grand-parent *{display:block; border:2px solid #aaa; color:#aaa; padding:5px; margin:5px;}</style></head><body><div class="great-grand-parent"><div class="grand-parent" style="width:500px;"><ul class="parent"><li class="child-one">Child One</li><li class="child-two">Child Two</li></ul></div><div class="grand-parent" style="width:500px;"><ul class="parent"><li class="child-three">Child Three</li><li class="child-four">Child Four</li></ul></div></div><br><button>Mark Children</button></body></html>

    jQuery find() Method

    The jQuery find() method returns all descendants of the matched element. Following is a simple syntax of the method:

    $(selector).find([ilter)

    Here filter selector is mandatory for this method. To return all the descendants of the matched element, we need to pass * as a filter otherwise if the filter is supplied as an element, the elements will be filtered by testing whether they match it.

    Synopsis

    Consider the following HTML content:

    <div class="great-grand-parent"><div class="grand-parent"><ul class="parent"><li class="child-one">Child One</li><li class="child-two">Child Two</li></ul></div><div class="grand-parent"><ul class="parent"><li class="child-three">Child Three</li><li class="child-four">Child Four</li></ul></div></div>

    Now if we use the find(“li”) method as follows:

    $(".grand-parent").find("li").css("border","2px solid red");

    It will produce following result:

    <div class="great-grand-parent"><div class="grand-parent"><ul class="parent"><li class="child-one"  style="border:2px solid red">Child One</li><li class="child-two"  style="border:2px solid red">Child Two</li></ul></div><div class="grand-parent" style="border:2px solid red"><ul class="parent"><li class="child-three"  style="border:2px solid red">Child Three</li><li class="child-four"  style="border:2px solid red">Child Four</li></ul></div></div>

    Example

    Let’s try the following example and verify the result:

    <!doctype html><html><head><title>The jQuery Example</title><script src="https://www.tutorialspoint.com/jquery/jquery-3.6.0.js"></script><script>$(document).ready(function(){$("button").click(function(){$(".grand-parent").find("li").css("border","2px solid red");});});</script><style>.great-grand-parent *{display:block; border:2px solid #aaa; color:#aaa; padding:5px; margin:5px;}</style></head><body><div class="great-grand-parent"><div class="grand-parent" style="width:500px;"><ul class="parent"><li class="child-one">Child One</li><li class="child-two">Child Two</li></ul></div><div class="grand-parent" style="width:500px;"><ul class="parent"><li class="child-three">Child Three</li><li class="child-four">Child Four</li></ul></div></div><br><button>Mark Children</button></body></html>

    jQuery Traversing Reference

    You can get a complete reference of all the jQuery Methods to traverse the DOM at the following page: jQuery Traversing Reference.

  • Traversing Ancestors

    jQuery provides methods to traverse upwards inside the DOM tree to find ancestor(s) of a given element. These methods can be used to find a parent, grandparent, great-grandparent, and so on for a given element inside the DOM.

    There are following three methods to traverse upward inside the DOM tree:

    • parent() – returns the direct parent of the each matched element.
    • parents() – returns all the ancestor elements of the matched element.
    • parentsUntil() – returns all ancestor elements until it finds the element given as selector argument.

    jQuery parent() Method

    The jQuery parent() method returns the direct parent of the each matched element. Following is a simple syntax of the method:

    $(selector).parent([filter])

    We can optionally provide a filter selector in the method. If the filter is supplied, the elements will be filtered by testing whether they match it.

    Synopsis

    Consider the following HTML content:

    <div class="great-grand-parent"><div class="grand-parent"><ul class="parent"><li class="child-one">Child One</li><li class="child-two">Child Two</li></ul></div></div>

    Now if we use the parent() method as follows:

    $(".child-two").parent().css("border","2px solid red");

    It will produce following result:

    <div class="great-grand-parent"><div class="grand-parent"><ul class="parent" style="border:2px solid red"><li class="child-one">Child One</li><li class="child-two">Child Two</li></ul></div></div>

    Example

    Let’s try the following example and verify the result:

    <!doctype html><html><head><title>The jQuery Example</title><script src="https://www.tutorialspoint.com/jquery/jquery-3.6.0.js"></script><script>$(document).ready(function(){$("button").click(function(){$(".child-two").parent().css("border","2px solid red");});});</script><style>.great-grand-parent *{display:block; border:2px solid #aaa; color:#aaa; padding:5px; margin:5px;}</style></head><body><div class="great-grand-parent"><div style="width:500px;"class="grand-parent"><ul class="parent"><li class="child-one">Child One</li><li class="child-two">Child Two</li></ul></div></div><br><button>Mark Parent</button></body></html>

    You can try the same example by creating another block of parent and child elements with the same classes and then verify that parent() will apply given CSS to all the matched elements.

    jQuery parents() Method

    The jQuery parents() method returns all the ancestor elements of the matched element. Following is a simple syntax of the method:

    $(selector).parents([filter])

    We can optionally provide a filter selector in the method. If the filter is supplied, the elements will be filtered by testing whether they match it.

    The parents() and parent() methods are similar, except that the parent() method only travels a single level up the DOM tree. Also, $( “html” ).parent() method returns a set containing document whereas $( “html” ).parents() returns an empty set.

    Synopsis

    Consider the following HTML content:

    <div class="great-grand-parent"><div class="grand-parent"><ul class="parent"><li class="child-one">Child One</li><li class="child-two">Child Two</li></ul></div></div>

    Now if we use the parents() method as follows:

    $(".child-two").parents().css("border","2px solid red");

    It will produce following result:

    <div class="great-grand-parent" style="border:2px solid red"><div class="grand-parent" style="border:2px solid red"><ul class="parent" style="border:2px solid red"><li class="child-one">Child One</li><li class="child-two">Child Two</li></ul></div></div>

    Example

    Let’s try the following example and verify the result. Here we are going to filter only <div> elements for clarity purpose:

    <!doctype html><html><head><title>The jQuery Example</title><script src="https://www.tutorialspoint.com/jquery/jquery-3.6.0.js"></script><script>$(document).ready(function(){$("button").click(function(){$(".child-two").parents("div").css("border","2px solid red");});});</script><style>.great-grand-parent *{display:block; border:2px solid #aaa; color:#aaa; padding:5px; margin:5px;}</style></head><body><div style="width:525px;"class="great-grand-parent"><div style="width:500px;"class="grand-parent"><ul class="parent"><li class="child-one">Child One</li><li class="child-two">Child Two</li></ul></div></div><br><button>Mark Parents</button></body></html>

    jQuery parentsUntil() Method

    The jQuery parentsUntil() method returns all the ancestor elements available between two selectors. Following is a simple syntax of the method:

    $(selector1).parentsUntil([selector2][,filter])

    We can optionally provide a filter selector in the method. If the filter is supplied, the elements will be filtered by testing whether they match it.

    Synopsis

    Consider the following HTML content:

    <div class="great-grand-parent"><div class="grand-parent"><ul class="parent"><li class="child-one">Child One</li><li class="child-two">Child Two</li></ul></div></div>

    Now if we use the parentsUntil() method as follows:

    $(".child-two").parentsUntil(".great-grand-parent").css("border","2px solid red");

    It will produce following result:

    <div class="great-grand-parent"><div class="grand-parent" style="border:2px solid red"><ul class="parent" style="border:2px solid red"><li class="child-one">Child One</li><li class="child-two">Child Two</li></ul></div></div>

    Example

    Let’s try the following example and verify the result:

    <!doctype html><html><head><title>The jQuery Example</title><script src="https://www.tutorialspoint.com/jquery/jquery-3.6.0.js"></script><script>$(document).ready(function(){$("button").click(function(){$(".child-two").parentsUntil(".great-grand-parent").css("border","2px solid red");});});</script><style>.great-grand-parent,.great-grand-parent *{display:block; border:2px solid #aaa; color:#aaa; padding:5px; margin:5px;}</style></head><body><div style="width:525px;"class="great-grand-parent"><div style="width:500px;"class="grand-parent"><ul class="parent"><li class="child-one">Child One</li><li class="child-two">Child Two</li></ul></div></div><br><button>Mark Parents</button></body></html>

    jQuery Traversing Reference

    You can get a complete reference of all the jQuery Methods to traverse the DOM at the following page: jQuery Traversing Reference.

  •  DOM Traversing

    jQuery is a very powerful tool which provides a variety of DOM traversal methods to help us select elements in an HTML or XML document randomly as well as in sequential method. Elements in the DOM are organized into a tree-like data structure that can be traversed to navigate, locate the content within an HTML or XML document.

    Document Object Model (DOM) – is a W3C (World Wide Web Consortium) standard that allows us to create, change, or remove elements from the HTML or XML documents.

    The DOM tree can be imagined as a collection of nodes related to each other through parent-child and sibling-sibling relationships and the root start from the top parent which is HTML element in an HTML document.

    Before we start traversing a DOM, Let’s understand the terminology of parentchild and sibling. Let’s see an example:

    <body><p>This is paragrah</p><div><span>This is div</span></div><button id="b1">Get width</button><button id="b2">Set width</button></body>

    In the above example, we have a <body> element at the top, which is called a parent for all the elements. The <div>, <p> and <button> elements inside the <body> element are called siblings. Again <span> element inside <div> is a child of <div> and <div> is called a parent of <span> element.

    The <div> element is a next sibling of the <p> element and <p> is the previous sibling of the <div> element.

    Traversing the DOM

    Most of the DOM Traversal Methods do not modify the jQuery DOM object and they are used to filter out elements from a document based on given conditions. jQuery provides methods to traverse in the following three directions:

    • Traversing Upwards – This direction means traversing the ancestors (Parent, Grandparent, Great-grandparent etc.)
    • Traversing Downwards – This direction means traversing the descendants (Child, Grandchild, Great-grandchild etc.)
    • Sideways – This direction means traversing the ancestors the siblings (Brother, sisters available at the same level)

    We will learn all the above traversing methods starting from the next chapter.

    jQuery Traversing Reference

    You can get a complete reference of all the jQuery Methods to traverse the DOM at the following page: jQuery Traversing Reference.

  • Callback Functions

    jQuery Callback Function is a function that will be executed only after the current effect gets completed. This tutorial will explain you what are jQuery Callback Functions and why to use them.

    Following is a simple syntax of any jQuery effect method:

    $(selector).effectName(speed, callback);

    If we go in a little more detail then a jQuery callback function will be written as follows:

    $(selector).effectName(speed,function(){<!--function body -->});

    Example without Callback Function

    First let’s take a jQuery program which does not make use of callback function so here alert message is being displayed even before the hide effect is getting completed.

    <!doctype html><html><head><title>The jQuery Example</title><script src="https://www.tutorialspoint.com/jquery/jquery-3.6.0.js"></script><script>$(document).ready(function(){$("div").click(function(){$(this).hide(1000);alert("I'm hidden now");});});</script><style>
       div{ margin:10px;padding:12px; border:2px solid #666; width:60px; cursor:pointer}</style></head><body><p>Click on any of the squares to see the result:</p><div>Hide Me</div><div>Hide Me</div><div>Hide Me</div></body></html>

    jQuery Callback Functions

    jQuery callback functions are required due to asynchronous nature of Javascript (jQuery) code execution. jQuery effects may take sometime to complete, so there is a chance that the next lines of code may get executed while the effects are still being executed. To handle asynchronous execution of the code, jQuery allows to pass a callback in all the effect methods and the purpose of this callback function is to be executed only when the effect gets completed.

    Example

    Let’s re-write the above example once again and this time we make use of a callback function which is executed after the hide effect is completed:.

    <!doctype html><html><head><title>The jQuery Example</title><script src="https://www.tutorialspoint.com/jquery/jquery-3.6.0.js"></script><script>$(document).ready(function(){$("div").click(function(){$(this).hide(1000,function(){alert("I'm hidden now");});});});</script><style>
       div{ margin:10px;padding:12px; border:2px solid #666; width:60px; cursor:pointer}</style></head><body><p>Click on any of the squares to see the result:</p><div>Hide Me</div><div>Hide Me</div><div>Hide Me</div></body></html>

    Callback with Animation

    jQuery animate() method also gives provision to make use of a callback functions.

    Example

    The following example makes use of a callback function which is executed after the animate effect is completed:.

    <html><head><title>The jQuery Example</title><script src="https://www.tutorialspoint.com/jquery/jquery-3.6.0.js"></script><script>$(document).ready(function(){$("#right").click(function(){$("div").animate({left:'250px'},1000,function(){alert("I have reached to the right");});});$("#left").click(function(){$("div").animate({left:'0px'},1000,function(){alert("I have reached to the left");});});});</script><style>
       button{width:100px;cursor:pointer}
       #box{position:relative;margin:3px;padding:12px;height:100px; width:180px;background-color:#9c9cff;}</style></head><body><p>Click on Left or Right button to see the result:</p><div id="box">This is Box</div><button id="right">Right Move</button><button id="left">Left Move</button></body></html>
  • Chaining

    Before we discuss about jQuery Chaining of Methods, Consider a situation when you want to perform the following actions on an HTML element:

    • 1 – Select a paragraph element.
    • 2 – Change the color of the paragraph.
    • 3 – Apply FadeOut efect on the paragraph.
    • 4 – Apply FadeIn effect on the paragraph.

    Following is the jQuery program to perform the above mentioned actions:

    <!doctype html><html><head><title>The jQuery Example</title><script src="https://www.tutorialspoint.com/jquery/jquery-3.6.0.js"></script><script>$(document).ready(function(){$("button").click(function(){$("p").css("color","#fb7c7c");$("p").fadeOut(1000);$("p").fadeIn(1000);});});</script><style>
       button{width:100px;cursor:pointer;}</style></head><body><p>Click the below button to see the result:</p><button>Click Me</button></body></html>

    jQuery Method Chaining

    jQuery method chaining allows us to call multiple jQuery methods using a single statement on the same element(s). This gives a better performance because while using chaining, we do not need to parse the whole page every time to find the element.

    To chain different methods, we simply need to append the method to the previous method. For example our above program can be written as below:

    <!doctype html><html><head><title>The jQuery Example</title><script src="https://www.tutorialspoint.com/jquery/jquery-3.6.0.js"></script><script>$(document).ready(function(){$("button").click(function(){$("p").css("color","#fb7c7c").fadeOut(1000).fadeIn(1000);});});</script><style>
       button{width:100px;cursor:pointer;}</style></head><body><p>Click the below button to see the result:</p><button>Click Me</button></body></html>

    Animation with Chaining

    We can take advantage of jQuery Method Chaining while writing jQuery animation programs. Following is a simple animation program written with the help of chaining:

    <html><head><title>The jQuery Example</title><script src="https://www.tutorialspoint.com/jquery/jquery-3.6.0.js"></script><script>$(document).ready(function(){$("button").click(function(){$("div").animate({left:'250px'}).animate({top:'100px'}).animate({left:'0px'}).animate({top:'0px'});});});</script><style>
       button {width:125px;cursor:pointer}
       #box{position:relative;margin:3px;padding:10px;height:20px; width:100px;background-color:#9c9cff;}</style></head><body><p>Click on Start Animation button to see the result:</p><div id="box">This is Box</div><button>Start Animation</button></body></html>

  • Animation

    Let’s learn how to use jQuery animate() method to create custom animations on a web pages or any other jQuery (Javascript) Application.

    jQuery animate() Method

    The jQuery animate() method is used to create custom animations by changing the CSS numerical properties of a DOM element, for example, width, height, margin, padding, opacity, top, left, etc.

    Following is a simple syntax of animate() method:

    $(selector).animate({ properties },[speed, callback]);

    jQuery animate() method can not be used to animate non-numeric properties such as color or background-color etc. Though you can use jQuery plugin jQuery.Color to animate such properties.

    You can apply any jQuery selector to select any DOM element and then apply jQuery animate() method to animate it. Here is the description of all the parameters which gives you a complete control over the animation −

    • properties − A required parameter which defines the CSS properties to be animated and this is the only mandatory parameter of the call.
    • speed − An optional string representing one of the three predefined speeds (“slow”, “normal”, or “fast”) or the number of milliseconds to run the animation (e.g. 1000).
    • callback − An optional parameter which represents a function to be executed whenever the animation completes.

    Animation Pre-Requisite

    (a) – The animate() method does not make hidden elements visible as part of the effect. For example, given $(selector).hide().animate({height: “20px”}, 500), the animation will run, but the element will remain hidden.

    (b) – To manipulate the position of a DOM element as a part of the animation, first we need to set it’s position to relativefixed, or absolute because by default, all HTML elements have a static position, and they cannot be moved using animate() method.

    Example

    The following example shows how to use animate() method to move a <div> element to the right, until it has reached a left property of 250px. Next when we click left button, the same <div> element returns to it’s initial position.

    <!doctype html><html><head><title>The jQuery Example</title><script src ="https://www.tutorialspoint.com/jquery/jquery-3.6.0.js"></script><script>$(document).ready(function(){$("#right").click(function(){$("div").animate({left:'250px'});});$("#left").click(function(){$("div").animate({left:'0px'});});});</script><style>
       #left, #right{margin:3px;border:2px solid #666; height:30px; width:100px;cursor:pointer;}
       #box{position:relative;margin:3px;padding:12px;border:2px solid #666;  height:100px; width:180px;}</style></head><body><p>Click on Left or Right button to see the result:</p><div id="box"  style="background-color:#9c9cff;">This is Box</div><button id="right" style="background-color:#fb7c7c;">Right Move</button><button id="left" style="background-color:#93ff93;">Left Move</button></body></html>

    Animation with Custom Speed

    We can animate different CSS numerical properties (for example, width, height, or left) of a DOM element with different speed.

    Example

    Let’s re-write above example, where we will animate <div>’s right movement with a speed parameter of 1000 milliseconds, and left movement with a speed parameter of 5000 milliseconds.

    <!doctype html><html><head><title>The jQuery Example</title><script src ="https://www.tutorialspoint.com/jquery/jquery-3.6.0.js"></script><script>$(document).ready(function(){$("#right").click(function(){$("div").animate({left:'250px'},1000);});$("#left").click(function(){$("div").animate({left:'0px'},5000);});});</script><style>
       #left, #right{margin:3px;border:2px solid #666; height:30px; width:100px;cursor:pointer;}
       #box{position:relative;margin:3px;padding:12px;border:2px solid #666;  height:100px; width:180px;}</style></head><body><p>Click on Left or Right button to see the result:</p><div id="box"  style="background-color:#9c9cff;">This is Box</div><button id="right" style="background-color:#fb7c7c;">Right Move</button><button id="left" style="background-color:#93ff93;">Left Move</button></body></html>

    Animation with Pre-defined Values

    We can use strings ‘show’‘hide’, and ‘toggle’ as the value of CSS numeric properties.

    Example

    Following is an example where we are setting left property of an element to either hide or show with the help of two buttons.

    Please note setting ANY of the numeric CSS properties with these values will produce the same result. For example if you will set element’s width or height at hide then it will hide the element regardless you set it’s width property or height property.

    <!doctype html><html><head><title>The jQuery Example</title><script src ="https://www.tutorialspoint.com/jquery/jquery-3.6.0.js"></script><script>$(document).ready(function(){$("#right").click(function(){$("div").animate({left:'hide'});});$("#left").click(function(){$("div").animate({left:'show'});});});</script><style>
       #left, #right{margin:3px;border:2px solid #666; height:30px; width:100px;cursor:pointer;}
       #box{position:relative;margin:3px;padding:12px;border:2px solid #666;  height:100px; width:180px;}</style></head><body><p>Click on Left or Right button to see the result:</p><div id="box"  style="background-color:#9c9cff;">This is Box</div><button id="right" style="background-color:#fb7c7c;">Right Move</button><button id="left" style="background-color:#93ff93;">Left Move</button></body></html>

    Animation with Multiple Properties

    jQuery animate() allows us to animate multiple CSS properties of an element at the same time.

    Example

    Following is an example to animate multiple CSS properties of a <div> element. When we click on Right Move button, this <div> starts moving towards the right direction till it reaches a left property value to 250px, at the same time element’s opacity reduces to 0.2 and width & height of the box decreases to 100px. Next, when we click on the Left Move button, this box returns to its initial position and size.

    <!doctype html><html><head><title>The jQuery Example</title><script src ="https://www.tutorialspoint.com/jquery/jquery-3.6.0.js"></script><script>$(document).ready(function(){$("#right").click(function(){$("div").animate({left:'250px', width:'100px', height:'100px', opacity:0.2});});$("#left").click(function(){$("div").animate({left:'0px',width:'180px', height:'100px', opacity:1.0});});});</script><style>
       #left, #right{margin:3px;border:2px solid #666; height:30px; width:100px;cursor:pointer;}
       #box{position:relative;margin:3px;padding:12px;border:2px solid #666;  height:100px; width:180px;}</style></head><body><p>Click on Left or Right button to see the result:</p><div id="box"  style="background-color:#9c9cff;">This is Box</div><button id="right" style="background-color:#fb7c7c;">Right Move</button><button id="left" style="background-color:#93ff93;">Left Move</button></body></html>

    Animation with Queue Functionality

    Consider a situation where you need to apply multiple animations which means you need to call animate() method multiple times one after the other. In such situation, jQuery handles these animation requests through a fist-in-fist-out (FIFO) queue and allows to create interesting animations based on your creativity.

    Example

    Following is an example where we call animate() methods 4 times to take a <div> into multiple directions one by one.

    <!doctype html><html><head><title>The jQuery Example</title><script src="https://www.tutorialspoint.com/jquery/jquery-3.6.0.js"></script><script>$(document).ready(function(){$("button").click(function(){$("div").animate({left:'250px'});$("div").animate({top:'100px'});$("div").animate({left:'0px'});$("div").animate({top:'0px'});});});</script><style>
       button {margin:3px;border:2px solid #666; height:30px; width:180px;cursor:pointer;}
       #box{position:relative;margin:3px;padding:2px;border:2px solid #666;  height:30px; width:170px;}</style></head><body><p>Click on Start Animation button to see the result:</p><div id="box"  style="background-color:#9c9cff;">This is Box</div><button style="background-color:#93ff93;">Start Animation</button></body></html>

    jQuery Effects Reference

    You can get a complete reference of all the jQuery Effect Methods at the following page: jQuery Effects Reference.

  • Effects

    jQuery effects add an X factor to your website interactivity. jQuery provides a trivially simple interface for doing various kind of amazing effects like show, hide, fade-in, fade-out, slide-up, slide-down, toggle etc. jQuery methods allow us to quickly apply commonly used effects with a minimum configuration. This tutorial covers all the important jQuery methods to create visual effects.

    jQuery Effect – Hiding Elements

    jQuery gives simple syntax to hide an element with the help of hide() method:

    $(selector).hide([speed, callback]);

    You can apply any jQuery selector to select any DOM element and then apply jQuery hide() method to hide it. Here is the description of all the parameters which gives you a solid control over the hiding effect −

    • speed − This optional parameter represents one of the three predefined speeds (“slow”, “normal”, or “fast”) or the number of milliseconds to run the animation (e.g. 1000).
    • callback − This optional parameter represents a function to be executed whenever the animation completes; executes once for each element animated against.

    The default speed duration ‘normal’ is 400 milliseconds. The strings ‘fast’ and ‘slow’ can be supplied to indicate durations of 200 and 600 milliseconds, respectively. Higher values indicate slower animations.

    Example

    Following is an example where a <div> will hide itself when we click over it. We have used 1000 as speed parameter which means it will take 1 second to apply the hide effect on the clicked element.

    <!doctype html><html><head><title>The jQuery Example</title><script src="https://www.tutorialspoint.com/jquery/jquery-3.6.0.js"></script><script>$(document).ready(function(){$("div").click(function(){$(this).hide(1000);});});</script><style>
       div{ margin:10px;padding:12px; border:2px solid #666; width:60px; cursor:pointer}</style></head><body><p>Click on any of the squares to see the result:</p><div>Hide Me</div><div>Hide Me</div><div>Hide Me</div></body></html>

    jQuery Effect – Show Elements

    jQuery gives simple syntax to show a hidden element with the help of show() method:

    $(selector).show([speed, callback]);

    You can apply any jQuery selector to select any DOM element and then apply jQuery show() method to show it. Here is the description of all the parameters which gives you a control over the show effect −

    • speed − An optional string representing one of the three predefined speeds (“slow”, “normal”, or “fast”) or the number of milliseconds to run the animation (e.g. 1000).
    • callback − This optional parameter represents a function to be executed whenever the animation completes; executes once for each element animated against.

    Example

    Following is an example where we will play with a Box with the help of two buttons. We will use these two buttons to show and hide this Box. We have used different speeds for the two effects hide(5000) and show(1000) to show the difference in effect speed.

    <!doctype html><html><head><title>The jQuery Example</title><script src="https://www.tutorialspoint.com/jquery/jquery-3.6.0.js"></script><script>$(document).ready(function(){$("#show").click(function(){$("#box").show(1000);});$("#hide").click(function(){$("#box").hide(5000);});});</script><style>
       button{cursor:pointer;}
       #box{margin-bottom:5px;padding:12px;height:100px; width:125px; background-color:#9c9cff;}</style></head><body><p>Click on Show and Hide buttons to see the result:</p><div id="box">This is Box</div><button id="hide">Hide Box</button><button id="show">Show Box</button></body></html>

    jQuery Effect – Toggle Elements

    jQuery provides toggle() methods to toggle the display state of elements between revealed or hidden. If the element is initially displayed, it will be hidden; if hidden, it will be shown.

    $(selector).toggle([speed, callback]);

    You can apply any jQuery selector to select any DOM element and then apply jQuery toggle() method to toggle it. Here is the description of all the parameters which gives you a solid control over the toggle effect −

    • speed − An optional string representing one of the three predefined speeds (“slow”, “normal”, or “fast”) or the number of milliseconds to run the animation (e.g. 1000).
    • callback − This optional parameter represents a function to be executed whenever the animation completes; executes once for each element animated against.

    Example

    Following is an example where we will play with a Square Box with the help of a single Toggle button. When we click this button for the first time, square box becomes invisible, and next time when we click the button then square box becomes visible. We have used 1000 as speed parameter which means it will take 1 second to apply the toggle effect.

    <!doctype html><html><head><title>The jQuery Example</title><script src="https://www.tutorialspoint.com/jquery/jquery-3.6.0.js"></script><script>$(document).ready(function(){$("#button").click(function(){$("#box").toggle(1000);});});</script><style>
       button{margin:3px;width:125px;cursor:pointer;}
       #box{margin:3px;padding:12px; height:100px; width:100px;background-color:#9c9cff;}</style></head><body><p>Click on the Toggle Box button to see the box toggling:</p><div id="box">This is Box</div><button id="button">Toggle Box</button></body></html>

    jQuery Effect – Fading Elements

    jQuery gives us two methods – fadeIn() and fadeOut() to fade the DOM elements in and out of visibility.

    $(selector).fadeIn([speed, callback]);$(selector).fadeOut([speed, callback]);

    The jQuery fadeIn() method is used to fade in a hidden element where as fadeOut() method is used to fade out a visible element. Here is the description of all the parameters which gives you a control over the fading effects −

    • speed − An optional string representing one of the three predefined speeds (“slow”, “normal”, or “fast”) or the number of milliseconds to run the animation (e.g. 1000).
    • callback − This optional parameter represents a function to be executed whenever the animation completes; executes once for each element animated against.

    Example

    Following is an example where we will play with a Box with the help of two buttons. We will use these two buttons to show and hide this Box. We have used 1000 as speed parameter which means it will take 1 second to apply the effect.

    <!doctype html><html><head><title>The jQuery Example</title><script src="https://www.tutorialspoint.com/jquery/jquery-3.6.0.js"></script><script>$(document).ready(function(){$("#show").click(function(){$("#box").fadeIn(1000);});$("#hide").click(function(){$("#box").fadeOut(1000);});});</script><style>
       button{cursor:pointer;}
       #box{margin-bottom:5px;padding:12px;height:100px; width:150px; background-color:#9c9cff;}</style></head><body><p>Click on fadeOut and fadeIn buttons to see the result:</p><div id="box">This is Box</div><button id="hide">fadeOut Box</button><button id="show">fadeIn Box</button></body></html>

    jQuery Effect – Toggle with Fading

    jQuery provides fadeToggle() methods to toggle the display state of elements between the fadeIn() and fadeOut() methods. If the element is initially displayed, it will be hidden (ie. fadeOut()); if hidden, it will be shown (ie. fadeIn()).

    $(selector).fadeToggle([speed, callback]);

    This method gives the same functionality what we can have using toggle() method, but additionally, it gives fade in and fade out effect while toggling the element.

    Here is the description of all the parameters which gives you more control over the effect −

    • speed − An optional string representing one of the three predefined speeds (“slow”, “normal”, or “fast”) or the number of milliseconds to run the animation (e.g. 1000).
    • callback − This optional parameter represents a function to be executed whenever the animation completes; executes once for each element animated against.

    Example

    Following is an example where we will play with a Square Box with the help of a single button. When we click this button for the first time, square box fades out (hidden), and next time when we click the button then square box fades in (visible). We have used 1000 as speed parameter which means it will take 1 second to apply the toggle effect.

    <!doctype html><html><head><title>The jQuery Example</title><script src="https://www.tutorialspoint.com/jquery/jquery-3.6.0.js"></script><script>$(document).ready(function(){$("#button").click(function(){$("#box").fadeToggle(1000);});});</script><style>
       button{margin:3px;width:125px;cursor:pointer;}
       #box{margin:3px;padding:12px; height:100px; width:100px;background-color:#9c9cff;}</style></head><body><p>Click on the Toggle Box button to see the box toggling:</p><div id="box">This is Box</div><button id="button">Toggle Box</button></body></html>

    Try using jQuery $(selector).toggle() and $(selector).fadeToggle() methods to understand the minor difference between these two methods.

    jQuery Effect – Sliding Elements

    jQuery gives us two methods – slideUp() and slideDown() to slide up and slide down the DOM elements respectively. Following is the simple syntax for these two methods:

    $(selector).slideUp([speed, callback]);$(selector).slideDown( speed,[callback]);

    The jQuery slideUp() method is used to slide up an element where as slideDown() method is used to slide down. Here is the description of all the parameters which gives you more control over the effects −

    • speed − An optional string representing one of the three predefined speeds (“slow”, “normal”, or “fast”) or the number of milliseconds to run the animation (e.g. 1000).
    • callback − This optional parameter represents a function to be executed whenever the animation completes; executes once for each element animated against.

    Example

    Following is an example where we will play with a Box with the help of two buttons. We will use these two buttons to show and hide this Box. We have used 1000 as speed parameter which means it will take 1 second to apply the toggle effect.

    <!doctype html><html><head><title>The jQuery Example</title><script src="https://www.tutorialspoint.com/jquery/jquery-3.6.0.js"></script><script>$(document).ready(function(){$("#show").click(function(){$("#box").slideDown(1000);});$("#hide").click(function(){$("#box").slideUp(1000);});});</script><style>
       button{cursor:pointer;}
       #box{margin-bottom:5px;padding:12px;height:100px; width:120px; background-color:#9c9cff;}</style></head><body><p>Click on slideUp and slideDown buttons to see the result:</p><div id="box">This is Box</div><button id="hide">slideUp </button><button id="show">slideDown </button></body></html>

    jQuery Effect – Toggle with Sliding

    jQuery provides slideToggle() methods to toggle the display state of elements between the slideUp() and slideDown() methods. If the element is initially displayed, it will be hidden (ie. slideUp()); if hidden, it will be shown (ie. slideDown()).

    $(selector).slideToggle([speed, callback]);

    This method gives the same functionality what we can have using toggle() method, but additionally, it gives slide up and slide down effect while toggling the element.

    Here is the description of all the parameters which gives you more control over the effect −

    • speed − An optional string representing one of the three predefined speeds (“slow”, “normal”, or “fast”) or the number of milliseconds to run the animation (e.g. 1000).
    • callback − This optional parameter represents a function to be executed whenever the animation completes; executes once for each element animated against.

    Example

    Following is an example where we will play with a Square Box with the help of a single button. When we click this button for the first time, square box fades out (hidden), and next time when we click the button then square box fades in (visible). We have used 1000 as speed parameter which means it will take 1 second to apply the toggle effect.

    <!doctype html><html><head><title>The jQuery Example</title><script src="https://www.tutorialspoint.com/jquery/jquery-3.6.0.js"></script><script>$(document).ready(function(){$("#button").click(function(){$("#box").slideToggle(1000);});});</script><style>
       button{margin:3px;width:125px;cursor:pointer;}
       #box{margin:3px;padding:12px; height:100px; width:100px;background-color:#9c9cff;}</style></head><body><p>Click on the Toggle Box button to see the box toggling:</p><div id="box">This is Box</div><button id="button">Toggle Box</button></body></html>

    Try using jQuery $(selector).toggle()$(selector).slideToggle() and $(selector).fadeToggle() methods to understand the minor difference among these three methods.

    jQuery Effects Reference

    This tutorial covered only a few most frequently used jQuery effects, You can get a complete reference of all the jQuery Effect Methods at the following page: jQuery Effects Reference.

  • CSS Properties

    jQuery provides css() method to manipulate CSS properties of the matched elements.

    JQuery css() method does not modify the content of the jQuery object but they are used to get and set CSS properties on DOM elements.

    jQuery – Get CSS Properties

    jQuery css() method can be used to get the value of a CSS property associated with the first matched HTML element. Following is the syntax of the css() method:

    $(selector).css(propertyName);

    jQuery understands and returns the correct value for both css( “background-color” ) and css( “backgroundColor” ).

    Example

    Let’s try the following example and verify the result. This should return the background color of the first matched <div>.

    <!doctype html><html><head><title>The jQuery Example</title><script src="https://www.tutorialspoint.com/jquery/jquery-3.6.0.js"></script><script>$(document).ready(function(){$("button").click(function(){alert("Background color = "+$("div").css("background-color"));});});</script><style>
       button{margin:10px;width:150px;cursor:pointer}
       div{ margin:10px;padding:12px; width:125px;}</style></head><body><p>Click the below button to see the result:</p><div style="background-color:#9c9cff;">Blue</div><div style="background-color:#93ff93;">Green</div><button>Get CSS Property</button></body></html>

    jQuery – Set CSS Properties

    jQuery css() method can be used to set the value of one or more CSS properties associated with the matched HTML element. Following is the syntax of the css() method:

    $(selector).css(propertyName, value);

    Here both the parameters are required, propertyName represents a CSS property name where as value represents a valid value of the property.

    Example

    Let’s try the following example and verify the result. Here we will take the color of the first matched <div> and will change the text color of all <p> using the div background-color.

    <!doctype html><html><head><title>The jQuery Example</title><script src="https://www.tutorialspoint.com/jquery/jquery-3.6.0.js"></script><script>$(document).ready(function(){$("button").click(function(){var color =$("div").css("background-color");$("p").css("color", color);});});</script><style>
       button{margin:10px;width:150px;cursor:pointer}
       div{ margin:10px;padding:12px; width:125px;}</style></head><body><p>Click the below button to see the result:</p><div style="background-color:#9c9cff;">Blue</div><div style="background-color:#93ff93;">Green</div><button>Set CSS Property</button></body></html>

    jQuery – Set Multiple CSS Properties

    You can apply multiple CSS properties on the matched elements using a single jQuery method css(). You can apply as many properties as you like in a single call.

    Following is the syntax of the css() method to set multiple CSS properties:

    $(selector).css({propertyName1:value1, propertyName2:value2,...});

    Example

    Let’s try the following example and verify the result. Here we will set background color of all the <div> to “#fb7c7c;” and font-size to 25px.

    <!doctype html><html><head><title>The jQuery Example</title><script src="https://www.tutorialspoint.com/jquery/jquery-3.6.0.js"></script><script>$(document).ready(function(){$("button").click(function(){$("div").css({"background-color":"#fb7c7c","font-size":"25px"});});});</script><style>
       button{margin:10px;width:150px;cursor:pointer}
       div{ margin:10px;padding:12px; width:125px;}</style></head><body><p>Click the below button to see the result:</p><div style="background-color:#9c9cff;">Blue</div><div style="background-color:#93ff93;">Green</div><button>Set CSS Property</button></body></html>

    jQuery HTML/CSS Reference

    You can get a complete reference of all the jQuery Methods to manipulate CSS and HTML content at the following page: jQuery HTML/CSS Reference.

  • Dimensions

    jQuery provides various methods to get and set the CSS dimensions for the various properties. Following diagram explains how various dimensions (width, height, innerWidth, innerHeight, outerWidth, outerHeight) can be depicted for any HTML element:

    jQuery Dimensions

    jQuery Dimension Methods

    Following are the methods to manipulate CSS dimensions for the various properties of the HTML elements.

    • width() – This method gets or sets the width of an element
    • height() – This method gets or sets the height of an element
    • innerWidth() – This method gets or sets the inner width of an element.
    • innerHeight() – This method gets or sets the inner height of an element.
    • outerWidth() – This method gets or sets the outer width of an element.
    • outerHeight() This method gets or sets the outer height of an element.

    jQuery width() Method

    jQuery width() method gets the width for the first matched element or set the width of every matched element(s).

    $(selector).width([val]);

    We can use width() method with or without val parameter. If we do not provide a parameter to this method then it will return the width of the first matched element but if we provide a value as the parameter then it will set the width of all the matched elements.

    Example

    Let’s try the following example to get and set the width of a <div> element.

    <!doctype html><html><head><title>The jQuery Example</title><script src="https://www.tutorialspoint.com/jquery/jquery-3.6.0.js"></script><script>$(document).ready(function(){$("#b1").click(function(){alert("Box width = "+$("div").width());});$("#b2").click(function(){$("div").width("400px");});});</script><style>
       button{margin:10px;cursor:pointer}
       div{ margin:10px;padding:12px; width:140px;}</style></head><body><p>Click the below buttons to see the result:</p><div style="background-color:#93ff93;">Box</div><button id="b1">Get width</button><button id="b2">Set width</button></body></html>

    jQuery height() Method

    jQuery height() method gets the height for the first matched element or set the width of every matched element(s).

    $(selector).height([val]);

    We can use height() method with or without val parameter. If we do not provide a parameter to this method then it will return the height of the first matched element but if we provide a value as the parameter then it will set the height of all the matched elements.

    Example

    Let’s try the following example to get and set the height of a <div> element.

    <!doctype html><html><head><title>The jQuery Example</title><script src="https://www.tutorialspoint.com/jquery/jquery-3.6.0.js"></script><script>$(document).ready(function(){$("#b1").click(function(){alert("Box height = "+$("div").height());});$("#b2").click(function(){$("div").height("100px");});});</script><style>
       button{margin:10px;cursor:pointer}
       div{ margin:10px;padding:12px; width:155px;}</style></head><body><p>Click the below buttons to see the result:</p><div style="background-color:#93ff93;">Box</div><button id="b1">Get height</button><button id="b2">Set height</button></body></html>

    jQuery innerWidth() Method

    jQuery innerWidth() method gets the innerWidth for the first matched element or set the innerWidth of every matched element(s).

    $(selector).innerWidth([val]);

    We can use innerWidth() method with or without val parameter. If we do not provide a parameter to this method then it will return the innerWidth of the first matched element but if we provide a value as the parameter then it will set the innerWidth of all the matched elements.

    Example

    Let’s try the following example to get and set the innerWidth of a <div> element.

    <!doctype html><html><head><title>The jQuery Example</title><script src="https://www.tutorialspoint.com/jquery/jquery-3.6.0.js"></script><script>$(document).ready(function(){$("#b1").click(function(){alert("Box innerWidth = "+$("div").innerWidth());});$("#b2").click(function(){$("div").innerWidth("400px");});});</script><style>
       button{margin:10px;cursor:pointer}
       div{ margin:10px;padding:12px; width:140px;}</style></head><body><p>Click the below buttons to see the result:</p><div style="background-color:#93ff93;">Box</div><button id="b1">Get width</button><button id="b2">Set width</button></body></html>

    jQuery innerHeight() Method

    jQuery innerHeight() method gets the innerHeight for the first matched element or set the innerHeight of every matched element(s).

    $(selector).innerHeight([val]);

    We can use innerHeight() method with or without val parameter. If we do not provide a parameter to this method then it will return the innerHeight of the first matched element but if we provide a value as the parameter then it will set the innerHeight of all the matched elements.

    Example

    Let’s try the following example to get and set the innerHeight of a <div> element.

    <!doctype html><html><head><title>The jQuery Example</title><script src="https://www.tutorialspoint.com/jquery/jquery-3.6.0.js"></script><script>$(document).ready(function(){$("#b1").click(function(){alert("Box innerHeight = "+$("div").innerHeight());});$("#b2").click(function(){$("div").innerHeight("100px");});});</script><style>
       button{margin:10px;cursor:pointer}
       div{ margin:10px;padding:12px; width:155px;}</style></head><body><p>Click the below buttons to see the result:</p><div style="background-color:#93ff93;">Box</div><button id="b1">Get height</button><button id="b2">Set height</button></body></html>

    jQuery outerWidth() Method

    jQuery outerWidth() method gets the outerWidth for the first matched element or set the outerWidth of every matched element(s).

    $(selector).outerWidth([val]);

    We can use outerWidth() method with or without val parameter. If we do not provide a parameter to this method then it will return the outerWidth of the first matched element but if we provide a value as the parameter then it will set the outerWidth of all the matched elements.

    Example

    Let’s try the following example to get and set the outerWidth of a <div> element.

    <!doctype html><html><head><title>The jQuery Example</title><script src="https://www.tutorialspoint.com/jquery/jquery-3.6.0.js"></script><script>$(document).ready(function(){$("#b1").click(function(){alert("Box outerWidth = "+$("div").outerWidth());});$("#b2").click(function(){$("div").outerWidth("400px");});});</script><style>
       button{margin:10px;cursor:pointer}
       div{ margin:10px;padding:12px; width:140px;}</style></head><body><p>Click the below buttons to see the result:</p><div style="background-color:#93ff93;">Box</div><button id="b1">Get width</button><button id="b2">Set width</button></body></html>

    jQuery outerHeight() Method

    jQuery outerHeight() method gets the outerHeight for the first matched element or set the outerHeight of every matched element(s).

    $(selector).outerHeight([val]);

    We can use outerHeight() method with or without val parameter. If we do not provide a parameter to this method then it will return the outerHeight of the first matched element but if we provide a value as the parameter then it will set the outerHeight of all the matched elements.

    Example

    Let’s try the following example to get and set the outerHeight of a <div> element.

    <!doctype html><html><head><title>The jQuery Example</title><script src="https://www.tutorialspoint.com/jquery/jquery-3.6.0.js"></script><script>$(document).ready(function(){$("#b1").click(function(){alert("Box outerHeight = "+$("div").outerHeight());});$("#b2").click(function(){$("div").outerHeight("100px");});});</script><style>
       button{margin:10px;cursor:pointer}
       div{ margin:10px;padding:12px; width:155px;}</style></head><body><p>Click the below buttons to see the result:</p><div style="background-color:#93ff93;">Box</div><button id="b1">Get height</button><button id="b2">Set height</button></body></html>

    jQuery HTML/CSS Reference

    You can get a complete reference of all the jQuery Methods to manipulate CSS and HTML content at the following page: jQuery HTML/CSS Reference.

  • CSS Classes

    jQuery provides three methods addClass()removeClass() and toggleClass() to manipulate CSS classes of the elements.

    We have divided our CSS manipulation discussion into two parts. This chapter will discuss about manipulating CSS classes and the next chapter will discuss about manipulating CSS properties.

    jQuery – Adding CSS Classes

    jQuery provides addClass() method to add a CSS class to the matched HTML element(s). Following is the syntax of the addClass() method:

    $(selector).addClass(className);

    This method takes a parameter which is one or more space-separated classes to be added to the class attribute of each matched element. More than one class may be added at a time, separated by a space, to the set of matched elements, like so:

    $(selector).addClass("Class1 Class2");

    Synopsis

    Consider the following HTML content with CSS classes defined:

    <style>.big{ font-weight: bold; font-size:20px;}.small{ font-weight: normal; font-size:10px;}</style><body><div class="container"><h2>jQuery addClass() Method</h2><div class="hello">Hello</div><div class="goodbye">Goodbye</div></div></body>

    Now if we use the addClass() method as follows:

    $(".hello").addClass("big");$(".goodbye").addClass("small");

    It will produce following result:

    <body><div class="container"><h2>jQuery addClass() Method</h2><div class="hello big">Hello</div><div class="goodbye small">Goodbye</div></div></body>

    Please note that addClass() method does not replace an existing class, rather it simply adds the class, appending it to any which may already be assigned to the elements.

    Example

    Let’s try the following example and verify the result:

    <!doctype html><html><head><title>The jQuery Example</title><script src="https://www.tutorialspoint.com/jquery/jquery-3.6.0.js"></script><script>$(document).ready(function(){$("button").click(function(){$(".hello").addClass("big");$(".goodbye").addClass("small");});});</script><style>.big{ font-weight: bold; font-size:20px;}.small{ font-weight: normal; font-size:10px;}</style></head><body><div class="container"><h2>jQuery addClass() Method</h2><div class="hello">Hello</div><div class="goodbye">Goodbye</div></div><br><button>Add Class</button></body></html>

    jQuery – Removing CSS Classes

    jQuery provides removeClass() method to remove an existing CSS class from the matched HTML element(s). Following is the syntax of the removeClass() method:

    $(selector).removeClass(className);

    This method takes a parameter which is one or more space-separated classes to be removed from the class attribute of each matched element. More than one class may be removed at a time, separated by a space, from the set of matched elements, like so:

    $(selector).removeClass("Class1 Class2");

    Synopsis

    Consider the following HTML content with CSS classes defined:

    <style>.big{ font-weight: bold; font-size:20px;}.small{ font-weight: normal; font-size:10px;}</style><body><div class="container"><h2>jQuery removeClass() Method</h2><div class="hello big">Hello</div><div class="goodbye small">Goodbye</div></div></body>

    Now if we use the removeClass() method as follows:

    $(".hello").removeClass("big");$(".goodbye").removeClass("small");

    It will produce following result:

    <body><div class="container"><h2>jQuery removeClass() Method</h2><div class="hello">Hello</div><div class="goodbye">Goodbye</div></div></body>

    Example

    Let’s try the following example and verify the result:

    <!doctype html><html><head><title>The jQuery Example</title><script src="https://www.tutorialspoint.com/jquery/jquery-3.6.0.js"></script><script>$(document).ready(function(){$("button").click(function(){$(".hello").removeClass("big");$(".goodbye").removeClass("small");});});</script><style>.big{ font-weight: bold; font-size:20px;}.small{ font-weight: normal; font-size:10px;}</style></head><body><div class="container"><h2>jQuery removeClass() Method</h2><div class="hello big">Hello</div><div class="goodbye small">Goodbye</div></div><br><button>Remove Class</button></body></html>

    jQuery – Toggle CSS Classes

    jQuery provides toggleClass() method to toggle an CSS class on the matched HTML element(s). Following is the syntax of the toggleClass() method:

    $(selector).toggleClass(className);

    This method takes a parameter which is one or more space-separated classes to be toggled. If an element in the matched set of elements already has the class, then it is removed; if an element does not have the class, then it is added.

    Example

    Let’s try the following example and verify the result:

    <!doctype html><html><head><title>The jQuery Example</title><script src="https://www.tutorialspoint.com/jquery/jquery-3.6.0.js"></script><script>$(document).ready(function(){$("button").click(function(){$(".hello").toggleClass("big");});});</script><style>.big{ font-weight: bold; font-size:20px;}</style></head><body><div class="container"><h2>jQuery toggleClass() Method</h2><div class="hello big">Hello</div><div class="goodbye">Goodbye</div></div><br><button>Toggle Class</button></body></html>

    jQuery HTML/CSS Reference

    You can get a complete reference of all the jQuery Methods to manipulate CSS and HTML content at the following page: jQuery HTML/CSS Reference.