...

Library - JQuery

Back to Course

Lesson Description


Lession - #565 JQuery Chaining


With jQuery, you'll be able to chain together actions/methods. Chaining permits us to run multiple jQuery methods (on the same element>
within one statement.

To chain an action, you simply append the action to the previous action.

Example


<html>  
<head> 
 <title> jQuery Example</title>  
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js">  
 <script>  
  $(document>
.ready(function(>
{ $("button">
.click(function(>
{ $("#p1">
.css("color", "red">
.slideUp(2000>
.slideDown(2000>
; }>
; }>
; </script> </head> <body> <p id="p1">jQuery Chaining!!</p> <button>Click me</button> </body> </html>
Try it here