jQuery Example


Do you want to improve your jQuery skills?


jQuery Selectors

Demonstrate jQuery's hide() function, hiding the current HTML element.

Demonstrate jQuery's hide() function, hiding all <p> elements.

Demonstrate jQuery's hide() function, hiding all elements with class="test".

Demonstrate jQuery's hide() function, hiding the element with id="test".


jQuery Events


Demonstrate the jQuery click() event.


Demonstrate the jQuery dblclick() event.


Demonstrate the jQuery mouseenter() event.


Demonstrate the jQuery mouseleave() event.


Demonstrate the jQuery mousedown() event.


Demonstrate the jQuery mouseup() event.


Demonstrate the jQuery hover() event.


Demonstrate the jQuery focus() and blur() events.

Example Analysis


jQuery Hide/Show


Demonstrate the jQuery hide() method.


Demonstrate the jQuery hide() and show() methods.


jQuery toggle() is used to switch between hide() and show() methods.


Another example of hiding text.

Example Analysis


jQuery Fade In/Fade Out


Demonstrate the jQuery fadeIn() method.


Demonstrate the jQuery fadeOut() method.


Demonstrate the jQuery fadeToggle() method.


Demonstrate the jQuery fadeTo() method.

Example Analysis


jQuery Sliding


Demonstrate the jQuery slideDown() method.


Demonstrate the jQuery slideUp() method.


Demonstrate the jQuery slideToggle() method.

Example Analysis


jQuery Animation


Demonstrate the simple jQuery animate() method.


Demonstrate changing styles with the jQuery animate() method.


Demonstrate how to use relative values in the jQuery animate() method.


Demonstrate the predefined values "hide", "show", "toggle" with the animate() method.


Demonstrate more jQuery animate() method examples


Demonstrate more jQuery animate() method examples (multiple animate() callbacks).

Example Analysis


jQuery Stop Animations


Demonstrate the jQuery stop() method.


Demonstrate the jQuery stop() method.

Example Analysis


jQuery HTML Get and Attributes


Use the jQuery text() and html() methods to get content.


Use the jQuery val() method to get the value of a form field.


Use the jQuery attr() method to get attribute values.

Example Analysis


jQuery HTML Set Content and Attributes


Use the jQuery text(), html(), and val() methods to set content.

jQuery text() and html() - Set Content Using Callback Functions
Use text() and html() to set content and use callback functions


Use the jQuery attr() method to set attribute values.


Use the jQuery attr() method to set multiple attribute values.

jQuery attr() - Set Attribute Values Using Callback Functions
Set attribute values and use callback functions to call attr().

Example Analysis


jQuery HTML Add Elements/Content


Add content at the end of the selected elements


Add content at the beginning of the selected elements


Create new text/HTML elements, jQuery and JavaScript/DOM. Add after the new element text.


Add HTML elements before and after the selected elements.


Create new text/HTML elements, jQuery and JavaScript/DOM. Insert new elements at the end of the selected elements.

Example Analysis


jQuery HTML Remove Elements/Content


Remove the selected elements


Remove all child elements of the selected elements


Filter elements and remove

Example Analysis


jQuery Get and Set CSS Classes


Add class attributes to different elements


Use the addClass() method to add multiple classes


Remove classes from specified elements


Toggle (add/remove) classes on selected elements

Example Analysis


jQuery css() Method


Return the CSS property value of the first matched element


Set the specified CSS properties for all matched elements


Set CSS properties for multiple matched elements

Example Analysis


jQuery Dimensions


Return the width and height of the specified element


Return the inner-width/height of the specified element


Return the outer-width/height of the specified element


Return the outer-width/height of the specified element (including the outer border)

jQuery - Return the width() and height() of document and window
Return the width and height of the HTML document and window


Set the width and height of the specified element

Example Explained


jQuery Traversing - Ancestors


Demonstrate the jQuery parent() method.


Demonstrate the jQuery parents() method.


Demonstrate the jQuery parentsUntil() method.

Example Explained


jQuery Traversing - Descendants


Demonstrate the jQuery children() method.


Demonstrate the jQuery find() method.

Example Explained


jQuery Traversing - Siblings


Demonstrate the jQuery siblings() method.


Demonstrate the jQuery next() method.


Demonstrate the jQuery nextAll() method.


Demonstrate the jQuery nextUntil() method.

Example Explained


jQuery AJAX load() Method


Asynchronously load file content and insert it into the <div> element.


Asynchronously load the content of the specified element in the file and insert it into the <div> element.


Use the callback function of the jQuery load() method.

Example Explained


jQuery AJAX get() and post() Methods


Use the $.get() method to asynchronously retrieve data from the server.


Use the $.post() method to asynchronously retrieve data from the server.

Example Explained


More Examples

jQuery Dynamic Particle Effect
Other Extensions