jQuery Method Chaining

Minifycode 2020-01-29 Viewed 1.2K times Jquery

In this article, you will learn how to use jQuery Method Chaining


The example chains together the css()slideUp(), and slideDown() methods. The p1 element first changes to red, then it slides up, and then it slides down:-

<!DOCTYPE html>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
    $("#p1").css("color", "green").slideUp(2000).slideDown(3000);

<p id="p1">jQuery is fun!!</p>

<button>Click me</button>


jQuery Method Chaining
minify code